Document
Document · Type
Properties
Section titled “Properties”| Name | Type | Description |
|---|---|---|
basename | string | The last part of the path. |
bytes | Collection | The contents one byte at a time, read as you go. |
children | File[] | The same as contents. Null for a file that is not an archive. |
contents | File[] | For an archive such as a zip, what is inside it. |
cursor | int | How far through the contents the reading has got, in bytes. |
deleted | bool | True when it has been deleted. |
direct_uri | string | A link to download straight from the storage, when the share allows it. |
dirname | string | The path of the folder that holds it. |
display_name | string | The name without its extension. |
end | bool | True once everything has been read. |
events | bool | Whether changes made through this file raise Foldr events. Assign false to stop them. |
extension | string | The extension without the dot, or an empty string. |
google_export_extension | string | The extension a Google file exports to. |
google_export_mimetype | string | The MIME type a Google file exports to. |
hash | string | The SHA-256 of the contents. Call hash(algo) for another algorithm. |
hidden | bool | True when the storage marks it hidden. |
is_dir | bool | True for a folder, false for a file. |
is_google_doc | bool | True for a Google Docs, Sheets or Slides file. |
is_moved | bool | True when this event moved or renamed it. |
is_new | bool | True when this event created it. |
is_updated | bool | True when this event changed it. |
line | string | The next line of a text file. Each read moves on. |
lines | Collection | The lines of a text file, read as you go. |
mimetype | string | The MIME type, such as application/pdf. A folder has none. |
modified | Date | When it was last changed. Assigning a date sets it on storage that allows that. |
name | string | The name with its extension. Assigning a new string renames the file or folder. |
nice_path | string | The path as people see it in Foldr. It differs from path only on storage whose own paths are not readable (an id-based store, say). |
nice_uri | string | The same address built from nice_path. |
parent | Folder | The folder that holds it, or null at the top of the share. |
path | string | The path inside the share. |
search_uri | string | The address search knows it by. |
share | Share | The share it lives on. |
size | int | The size in bytes. A folder is 0. |
stream | stream | An open read stream of the contents. |
uri | string | The share and the path together, as one address. |
user | User | The account it was opened as. |
vendor_id | string | The id the storage gives it (Google Drive, OneDrive, Box and similar), when it has one. |
versions | array | The earlier versions, on storage that keeps them. |
Methods
Section titled “Methods”childrenComplete
Section titled “childrenComplete”document.childrenComplete() → bool
No description yet.
document.close()
No description yet.
delete
Section titled “delete”document.delete()
No description yet.
duplicate
Section titled “duplicate”document.duplicate(destination?: File, sourceVersion?: string)
No description yet.
export
Section titled “export”document.export()
No description yet.
getContents
Section titled “getContents”document.getContents()
No description yet.
getName
Section titled “getName”document.getName() → string
No description yet.
getParent
Section titled “getParent”document.getParent() → File
No description yet.
getPath
Section titled “getPath”document.getPath() → string
No description yet.
getSeekableStream
Section titled “getSeekableStream”document.getSeekableStream()
A fresh stream that can really seek; see FileStreamHandler::getSeekableStream().
getShare
Section titled “getShare”document.getShare() → Share
No description yet.
getStream
Section titled “getStream”document.getStream()
No description yet.
getUser
Section titled “getUser”document.getUser() → User
No description yet.
hasStatus
Section titled “hasStatus”document.hasStatus(status: FileStatus) → bool
No description yet.
document.hash(algo?: string = "sha256") → string
No description yet.
document.in(folders?: File) → bool
No description yet.
document.is(file: File) → bool
No description yet.
isDeleted
Section titled “isDeleted”document.isDeleted() → bool
No description yet.
document.isDir() → bool
No description yet.
isMoved
Section titled “isMoved”document.isMoved() → bool
No description yet.
document.isNew() → bool
No description yet.
isUpdated
Section titled “isUpdated”document.isUpdated() → bool
No description yet.
document.isZip() → bool
Checks if the file is a ZIP archive based on its mimetype.
listVersions
Section titled “listVersions”document.listVersions() → array
No description yet.
document.make(path: Stringable, asDir?: bool = false, suggest?: bool = false, force?: bool = false) → File
No description yet.
document.move(destination: Folder, suggest?: bool = false) → bool
No description yet.
document.read(length?: int)
No description yet.
readLine
Section titled “readLine”document.readLine()
No description yet.
refresh
Section titled “refresh”document.refresh()
No description yet.
release
Section titled “release”document.release()
No description yet.
rename
Section titled “rename”document.rename(newName: string) → bool
No description yet.
reserve
Section titled “reserve”document.reserve(ttl?: mixed = 10)
No description yet.
rewind
Section titled “rewind”document.rewind() → bool
No description yet.
document.seek(offset: int) → int
No description yet.
setUser
Section titled “setUser”document.setUser(user?: mixed)
The user this file is opened as: what sharing, permissions and activity act as. Takes a user, a MaSH user (file.setUser(owner)) or a GUID; null clears it. A script giving an event file a user so it can share it is the case this is called from MaSH for.
document.tell()
No description yet.
triggerEvents
Section titled “triggerEvents”document.triggerEvents()
No description yet.
version
Section titled “version”document.version(versionId: string)
No description yet.
document.write(args?: mixed) → Document
No description yet.