@fkn/lib/cloud/fs
Classes
Section titled “Classes”StorageLockedError
Section titled “StorageLockedError”Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new StorageLockedError(): StorageLockedError;Returns
Section titled “Returns”Overrides
Section titled “Overrides”Error.constructorProperties
Section titled “Properties”code: string = 'FKN_E2E_LOCKED';StorageNotFoundError
Section titled “StorageNotFoundError”There is no object at this path. Test err.code === STORAGE_NOT_FOUND, never the message.
Absence arrives from two places that word it completely differently: the api refusing to presign a path with no committed row says “Not found”, and a presign that succeeded followed by an object fetch that 404s says “storage: read failed (404)”. Neither is a fault, both mean the same thing, and matching either by hand means matching both. Ripple matched only the first, so a missing backup read as a transient failure, retried forever, and a library went un-backed-up for a day without a single error anywhere.
The distinction matters more than it sounds. “There is nothing here” is safe to overwrite; “I could not tell you” is not, and a caller that confuses them either never writes a first backup or destroys a real one.
Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new StorageNotFoundError(message?): StorageNotFoundError;Parameters
Section titled “Parameters”message?
Section titled “message?”string = 'storage: no object at that path'
Returns
Section titled “Returns”Overrides
Section titled “Overrides”Error.constructorProperties
Section titled “Properties”code: string = STORAGE_NOT_FOUND;Type Aliases
Section titled “Type Aliases”EncryptionStatus
Section titled “EncryptionStatus”type EncryptionStatus = object;Properties
Section titled “Properties”enrolled
Section titled “enrolled”enrolled: boolean;keyEpoch
Section titled “keyEpoch”keyEpoch: number | null;unlocked
Section titled “unlocked”unlocked: boolean;FileEntry
Section titled “FileEntry”type FileEntry = object;Properties
Section titled “Properties”contentType
Section titled “contentType”contentType: string | null;encryption
Section titled “encryption”encryption: string | null;path: string;size: number;updatedAt
Section titled “updatedAt”updatedAt: string;StorageQuota
Section titled “StorageQuota”type StorageQuota = object;Properties
Section titled “Properties”limitBytes
Section titled “limitBytes”limitBytes: number;maxObjects
Section titled “maxObjects”maxObjects: number;objects
Section titled “objects”objects: number;remaining
Section titled “remaining”remaining: number;usedBytes
Section titled “usedBytes”usedBytes: number;Variables
Section titled “Variables”available
Section titled “available”available: () => Promise<boolean>;Returns
Section titled “Returns”Promise<boolean>
mkdir: (path, a, b?) => void;Parameters
Section titled “Parameters”PathLike
MakeOptions | Callback<void>
Callback<void>
Returns
Section titled “Returns”void
promises
Section titled “promises”promises: object;Type Declaration
Section titled “Type Declaration”access
Section titled “access”access: (path) => Promise<void>;Parameters
Section titled “Parameters”PathLike
Returns
Section titled “Returns”Promise<void>
lstat: (path) => Promise<Stats> = stat;Parameters
Section titled “Parameters”PathLike
Returns
Section titled “Returns”mkdir: (_path?, _options?) => Promise<void>;Parameters
Section titled “Parameters”_path?
Section titled “_path?”PathLike
_options?
Section titled “_options?”MakeOptions
Returns
Section titled “Returns”Promise<void>
readdir
Section titled “readdir”readdir: (path) => Promise<string[]>;Parameters
Section titled “Parameters”PathLike
Returns
Section titled “Returns”Promise<string[]>
readFile
Section titled “readFile”readFile: (path, options?) => Promise<string | Buffer<ArrayBufferLike>>;Parameters
Section titled “Parameters”PathLike
options?
Section titled “options?”ReadOptions
Returns
Section titled “Returns”Promise<string | Buffer<ArrayBufferLike>>
rename
Section titled “rename”rename: (from, to) => Promise<void>;Parameters
Section titled “Parameters”PathLike
PathLike
Returns
Section titled “Returns”Promise<void>
rm: (path, options?) => Promise<void>;Parameters
Section titled “Parameters”PathLike
options?
Section titled “options?”recursive?
Section titled “recursive?”boolean
Returns
Section titled “Returns”Promise<void>
rmdir: (path, options?) => Promise<void> = rm;Parameters
Section titled “Parameters”PathLike
options?
Section titled “options?”recursive?
Section titled “recursive?”boolean
Returns
Section titled “Returns”Promise<void>
stat: (path) => Promise<Stats>;Parameters
Section titled “Parameters”PathLike
Returns
Section titled “Returns”unlink
Section titled “unlink”unlink: (path) => Promise<void>;Parameters
Section titled “Parameters”PathLike
Returns
Section titled “Returns”Promise<void>
writeFile
Section titled “writeFile”writeFile: (path, data, options?) => Promise<void>;Parameters
Section titled “Parameters”PathLike
options?
Section titled “options?”WriteOptions
Returns
Section titled “Returns”Promise<void>
readdir
Section titled “readdir”readdir: (path, a, b?) => void;Parameters
Section titled “Parameters”PathLike
unknown
Callback<string[]>
Returns
Section titled “Returns”void
readFile
Section titled “readFile”readFile: (path, a, b?) => void;Parameters
Section titled “Parameters”PathLike
ReadOptions | Callback<string | Buffer<ArrayBufferLike>>
Callback<string | Buffer<ArrayBufferLike>>
Returns
Section titled “Returns”void
rename
Section titled “rename”rename: (from, to, callback) => void;Parameters
Section titled “Parameters”PathLike
PathLike
callback
Section titled “callback”Callback<void>
Returns
Section titled “Returns”void
rm: (path, a, b?) => void;Parameters
Section titled “Parameters”PathLike
| Callback<void>
| {
recursive?: boolean;
}
Callback<void>
Returns
Section titled “Returns”void
stat: (path, callback) => void;Parameters
Section titled “Parameters”PathLike
callback
Section titled “callback”Callback<Stats>
Returns
Section titled “Returns”void
unlink
Section titled “unlink”unlink: (path, callback) => void;Parameters
Section titled “Parameters”PathLike
callback
Section titled “callback”Callback<void>
Returns
Section titled “Returns”void
writeFile
Section titled “writeFile”writeFile: (path, data, a, b?) => void;Parameters
Section titled “Parameters”PathLike
WriteOptions | Callback<void>
Callback<void>
Returns
Section titled “Returns”void
Functions
Section titled “Functions”encryption()
Section titled “encryption()”function encryption(): Promise<EncryptionStatus>;Returns
Section titled “Returns”isNotFound()
Section titled “isNotFound()”function isNotFound(error): boolean;Whether an error from this module means the path is empty, as opposed to unreadable.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean
quota()
Section titled “quota()”function quota(): Promise<StorageQuota>;Returns
Section titled “Returns”readFileSealed()
Section titled “readFileSealed()”function readFileSealed(path): Promise<SealedRead>;A cloud read that also reports when the copy was sealed.
sealedAt is an ISO string, or null when the envelope carries no such field (one written before
the seal time existed) or when the data plane is older than this call. The value is
AUTHENTICATED, so the server can neither forge nor alter it, and it is the WRITER’s own claim
about when it sealed, so on its own it does not prove this copy is the newest one: an older but
perfectly authentic copy of the same path is still authentic. An app that needs that answer keeps
a high-water mark per path and compares. Do not confuse it with the updatedAt on a listing,
which is the server’s hint and is fine for display and nothing else.
The bytes and the stamp come from ONE read of ONE envelope, which is what makes the stamp
describe the bytes returned beside it. readFile is unchanged and unaffected.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”unlock()
Section titled “unlock()”function unlock(): Promise<boolean>;Returns
Section titled “Returns”Promise<boolean>
References
Section titled “References”SealedRead
Section titled “SealedRead”Re-exports SealedRead
Re-exports Stats
STORAGE_NOT_FOUND
Section titled “STORAGE_NOT_FOUND”Re-exports STORAGE_NOT_FOUND