Update-File

Update File (Direct Access)

By Anonymous_cat1, co-written by GPT-4o-Mini.

A simple Turbowarp extension that uses the File System Access API to dynamically update files.

Security note

This will allow any Turbowarp project unrestricted access any file you specify, which means it could modify, delete, or inject something into a file without you even knowing about it! Never allow access to files that you care about to a project you’re not familiar with.

Browser support

Your browser must support the File System Access API, you can find a support list here. Otherwise, the extension will not work.

Installation

To use this extension in Turbowarp (or in it’s very plentiful mods), open Add Extension > Custom Extension and paste this link.

YOU MUST LOAD UNSANDBOXED. OTHERWISE IT WILL NOT IMPORT.

https://anonymous-cat1.github.io/Update-File/extension.js

How to use

To start, you can open a file with the Set File block. This should open your system’s file picker.

Now, you can update a file with the Write content to file from [Format Dropdown] (Text) block.

Dropdown options:

To read a file, use the Get content from file as [Format Dropdown] reporter.

Dropdown options:

To read a file’s metedata as JSON, use the Get file metadata as JSON reporter.

To check if a file is currentl;y opened, use the Is file opened? boolean.

To check if the current browser supports Direct Access (File System Access), use the Browser supports Direct Access? boolean.

Lastly, to close a flie you can use Close File.