@trayio/commons
Advanced tools
Comparing version
@@ -0,2 +1,4 @@ | ||
/// <reference types="node" /> | ||
import * as TE from 'fp-ts/lib/TaskEither'; | ||
import { Dirent } from 'fs'; | ||
import { File, FileStorage, SharedUrl } from './File'; | ||
@@ -11,3 +13,4 @@ export declare class NodeFsFileStorage implements FileStorage { | ||
createDirectory(key: string): TE.TaskEither<Error, undefined>; | ||
readDirectory(key: string): TE.TaskEither<Error, Dirent[]>; | ||
} | ||
//# sourceMappingURL=NodeFsFileStorage.d.ts.map |
@@ -71,3 +71,10 @@ "use strict"; | ||
} | ||
readDirectory(key) { | ||
const filePath = `${this.basePath}/${key}`; | ||
return TE.tryCatch(async () => { | ||
const files = await fs.readdir(filePath, { withFileTypes: true }); | ||
return files; | ||
}, (reason) => new Error(String(reason))); | ||
} | ||
} | ||
exports.NodeFsFileStorage = NodeFsFileStorage; |
{ | ||
"name": "@trayio/commons", | ||
"version": "4.18.1", | ||
"version": "4.18.2", | ||
"description": "Extensions to the standard/core libraries and basic features", | ||
@@ -5,0 +5,0 @@ "exports": { |
Sorry, the diff of this file is not supported yet
163161
0.32%3309
0.3%