Rootless

Automate iOS, iPadOS, and macOS using plain JavaScript. Build custom widgets and interact directly with native APIs.

Download on the App Store
Rootless app interface

Plain JavaScript

Supports ES6. Scripts are stored as plain .js files on your disk.

Native APIs & Documentation

Integrate directly with iOS native APIs. Fully documented, available offline.

Siri Shortcuts

Trigger scripts via Siri. Present tables, websites, and custom HTML natively.

System Integration

Run from the Share Sheet, process inputs, and manage local files via Files.app.

x-callback-url

Communicate seamlessly and trigger workflows with other apps on your device.

Customizable & Ready

Tailor the code editor to your liking. Includes several example scripts to start immediately.

Documentation

Also inside the app, or as rootless.json.

Data

Files and binary content

A Data value is bytes passed around as one value: Http.get(url).data and file.read('data') produce one, and file.write, QuickLook.present, ShareSheet.present, Image.from, an Http body and a multipart upload all take one. The bytes stay in the app until you convert them, so moving a large file between APIs costs nothing. A Data value lasts for one run: save it with file.write to keep it. Storage and Cache save it as base64 and give it back as Data.

Properties

typeString

Always 'data'.

mimeTypeString

What the bytes are, such as 'application/pdf' or 'image/png'.

sizeNumber

How many bytes.

Methods

Data.fromBase64(base64, mimeType?)Data ›

A Data value from base64. The type defaults to application/octet-stream.

  • base64 String required
  • mimeType String
Data.fromText(text, mimeType?)Data ›

A Data value holding a string as UTF-8. The type defaults to text/plain.

  • text String required
  • mimeType String
Data.toBase64(data)String

The bytes as base64. Copies them into the script, a third larger, so convert only when something needs a string.

Data.toText(data)String

The bytes read as UTF-8 text.

Examples

Download a PDF and open it

var pdf = Http.get("https://example.com/menu.pdf").data;
FileSystem.local.file("menu.pdf").write(pdf);
QuickLook.present(pdf);

Check before using

var file = Http.get(url).data;
if (file.mimeType !== "application/pdf" || file.size > 10e6) {
  console.warn("Not a PDF, or too large");
}

Upload a file

var csv = FileSystem.local.file("export.csv").read("data");
Http.post(uploadUrl, { multipart: [
  { name: "file", value: csv, filename: "export.csv" },
]});

Send it inside JSON

Http.post(apiUrl, { body: {
  name: "logo.png",
  content: Data.toBase64(logo),
}});