Feat/js metadata (#1548)

* feat: metadata effect

* feat: Metadata for effects

* chore: Add in the new types
This commit is contained in:
J M
2022-06-16 15:58:48 -06:00
committed by GitHub
parent 9c41090a7a
commit 452c8ea2d9
7 changed files with 144 additions and 22 deletions

View File

@@ -26,6 +26,7 @@ export namespace ExpectedExports {
) => Promise<ResultType<MigrationRes>>;
}
/** Used to reach out from the pure js runtime */
export type Effects = {
/** Usable when not sandboxed */
@@ -33,6 +34,7 @@ export type Effects = {
input: { path: string; volumeId: string; toWrite: string },
): Promise<void>;
readFile(input: { volumeId: string; path: string }): Promise<string>;
metadata(input: { volumeId: string; path: string }): Promise<Metadata>;
/** Create a directory. Usable when not sandboxed */
createDir(input: { volumeId: string; path: string }): Promise<string>;
/** Remove a directory. Usable when not sandboxed */
@@ -60,7 +62,20 @@ export type Effects = {
/** Sandbox mode lets us read but not write */
is_sandboxed(): boolean;
};
export type Metadata = {
fileType: string,
isDir: boolean,
isFile: boolean,
isSymlink: boolean,
len: number,
modified?: Date,
accessed?: Date,
created?: Date,
readonly: boolean,
}
export type MigrationRes = {
configured: boolean;