Reading Local Files You can read files from your local file system in Observable using a file input:
viewof image = html`<input type=file accept="image/*">`
A File is a Blob, so one way to read a file is to use URL.createObjectURL. This is useful, for example, with images. (Don’t forget to revoke your URLs, though, say using Generators.disposable.)
You can also read a file using a FileReader. Observable’s standard library includes several convenience methods for reading files.
If the file is text, use Files.text to obtain a promise to a String.
viewof text = html`<input type=file accept="text/*">`
For a binary file, use Files.buffer for a promise to an ArrayBuffer.
viewof binary = html`<input type=file>`