Wren

Module entries

The File and Directory Entries API for what the user dropped (src/page/dnd_entries.odin; native/js/runtime/web_entries.c): DataTransferItem.webkitGetAsEntry() gives a FileSystemFileEntry or a FileSystemDirectoryEntry for a dropped file or folder; a folder is listed lazily, one directory at a time, on a background thread (createReader().readEntries()), and its files are opened the same way (file()). Paths stay inside what was dropped: a path that leaves it ("..") is refused.

Exposed to: Window. Source: api/js_entries.widl.

Odin: import "wren:entries".

Types

handle FsEntry : Object

Checked by the browser on every call (lookup_FsEntry).

handle FsReader : Object

Checked by the browser on every call (lookup_FsReader).

struct FsEntryInfo

What an entry is.

fieldtype
is_dirbool

Functions

DataTransfer_itemEntry

FsEntry DataTransfer_itemEntry(DataTransfer dt, i32 index) raises

item.webkitGetAsEntry(): the entry of a file item (0: a string item, or the data store is protected).

Raises: returns an Error (see web).

Host: DataTransfer_itemEntry :: proc(c: ^Call, dt: Api_DataTransfer, index: i32) -> (u64, Api_Error)

FsEntry_info

FsEntryInfo FsEntry_info(FsEntry entry)

isFile / isDirectory

Host: FsEntry_info :: proc(c: ^Call, entry: Api_FsEntry) -> Api_FsEntryInfo

FsEntry_name

string FsEntry_name(FsEntry entry)

entry.name

Host: FsEntry_name :: proc(c: ^Call, entry: Api_FsEntry) -> string

FsEntry_fullPath

string FsEntry_fullPath(FsEntry entry)

entry.fullPath ("/" then the dropped item's name and the path below it, "/" separated)

Host: FsEntry_fullPath :: proc(c: ^Call, entry: Api_FsEntry) -> string

FsEntry_filesystemName

string FsEntry_filesystemName(FsEntry entry)

entry.filesystem.name

Host: FsEntry_filesystemName :: proc(c: ^Call, entry: Api_FsEntry) -> string

FsEntry_parent

FsEntry FsEntry_parent(FsEntry entry)

getParent(): the folder above (an entry is its own parent at the top of what was dropped).

Host: FsEntry_parent :: proc(c: ^Call, entry: Api_FsEntry) -> u64

FsEntry_root

FsEntry FsEntry_root(FsEntry entry)

entry.filesystem.root: the entry of what was dropped (the top of the entry's tree).

Host: FsEntry_root :: proc(c: ^Call, entry: Api_FsEntry) -> u64

FsEntry_file

Promise FsEntry_file(FsEntry entry)

fileEntry.file(): a promise of the File (NotFoundError when it went away, TypeMismatchError for a folder).

Host: FsEntry_file :: proc(c: ^Call, entry: Api_FsEntry) -> u64

FsEntry_lookup

Promise FsEntry_lookup(FsEntry dir, string path, bool directory)

dirEntry.getFile(path) / getDirectory(path): a promise of the entry (NotFoundError, TypeMismatchError when it is the other kind, SecurityError for a path that leaves what was dropped).

Host: FsEntry_lookup :: proc(c: ^Call, dir: Api_FsEntry, path: string, directory: bool) -> u64

FsEntry_createReader

FsReader FsEntry_createReader(FsEntry dir)

dirEntry.createReader()

Host: FsEntry_createReader :: proc(c: ^Call, dir: Api_FsEntry) -> u64

FsReader_read

Promise FsReader_read(FsReader reader)

reader.readEntries(): a promise of the number of entries of the next batch (0: the end), read with FsReader_entry.

Host: FsReader_read :: proc(c: ^Call, reader: Api_FsReader) -> u64

FsReader_entry

FsEntry FsReader_entry(FsReader reader, i32 index)

The entries of the last batch.

Host: FsReader_entry :: proc(c: ^Call, reader: Api_FsReader, index: i32) -> u64

Edit this page on GitHub