diff --git a/src/rt/rfwfs/main.ts b/src/rt/rfwfs/main.ts index 36d6d72..0e9c12d 100644 --- a/src/rt/rfwfs/main.ts +++ b/src/rt/rfwfs/main.ts @@ -24,6 +24,7 @@ interface EntryFile extends Entry { interface EntryCollection extends Entry { inner: EntryCollectionManipulate, } + interface EntryCollectionManipulate { __body: T[], clone: (file_name: string) => WrapResultEntry @@ -34,10 +35,10 @@ interface EntryCollectionManipulate { } interface Rfwfs { - directory: (default_name: string, permissions: Permissions, timestamp: number, inner_default?: T[]) => EntryCollection, + directory: (default_name: string, permissions: Permissions, timestamp?: number, inner_default?: T[]) => EntryCollection, is_file: (entry: T) => boolean, is_dir: (entry: T) => boolean, - file: (default_name: string, permissions: Permissions, timestamp: number, inner_default?: FileInner) => EntryFile, + file: (default_name: string, permissions: Permissions, timestamp?: number, inner_default?: FileInner) => EntryFile, } function read_write_access(permissions: Permissions): boolean { @@ -143,17 +144,17 @@ rfwfs.is_file = function(entry) { rfwfs.file = function(default_name, permissions, timestamp, inner_default) { const file = { type: EntryType.File } as EntryFile file.permissions = permissions - file.timestamp = timestamp + file.timestamp = timestamp ? timestamp : (Date.now()/1000)|0 file.inner = file_inner(permissions, inner_default ? inner_default : "") file.name = default_name file.hash = "0" return file } -rfwfs.directory = function(default_name: string, permissions: Permissions, timestamp: number, inner_default?: T[]): EntryCollection { +rfwfs.directory = function(default_name: string, permissions: Permissions, timestamp?: number, inner_default?: T[]): EntryCollection { const directory = { type: EntryType.Directory } as EntryCollection directory.permissions = permissions - directory.timestamp = timestamp + directory.timestamp = timestamp ? timestamp : (Date.now()/1000)|0 directory.inner = dir_inner(directory, inner_default ? inner_default : []) directory.name = default_name return directory