/** * Copyright (c) OpenLens Authors. All rights reserved. * Licensed under MIT License. See LICENSE in root directory for more information. */ import { getInjectable } from "@ogre-tools/injectable"; import type { Dirent } from "fs"; import fsInjectable from "./fs.injectable"; export interface ReadDirectory { ( path: string, options: "buffer" | { encoding: "buffer"; withFileTypes?: false | undefined } ): Promise; ( path: string, options?: | { encoding: BufferEncoding; withFileTypes?: false | undefined } | BufferEncoding ): Promise; ( path: string, options?: { encoding?: BufferEncoding; withFileTypes?: false | undefined }, ): Promise; ( path: string, options: { encoding?: BufferEncoding; withFileTypes: true }, ): Promise; } const readDirectoryInjectable = getInjectable({ id: "read-directory", instantiate: (di): ReadDirectory => di.inject(fsInjectable).readdir, }); export default readDirectoryInjectable;