fs: make imports esm compatible

This commit is contained in:
Abdullah Atta
2024-09-23 12:26:16 +05:00
parent 9647e2513b
commit 54de071e85
5 changed files with 15 additions and 13 deletions

View File

@@ -17,10 +17,10 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import FileStreamSource from "./filestreamsource";
import { IFileStorage } from "./interfaces";
import { File } from "./types";
import { chunkPrefix } from "./utils";
import FileStreamSource from "./filestreamsource.js";
import { IFileStorage } from "./interfaces.js";
import { File } from "./types.js";
import { chunkPrefix } from "./utils.js";
export default class FileHandle {
constructor(

View File

@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { File } from "./types";
import { IFileStorage } from "./interfaces";
import { File } from "./types.js";
import { IFileStorage } from "./interfaces.js";
export default class FileStreamSource {
private index = 0;

View File

@@ -17,10 +17,10 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import FileHandle from "./src/filehandle";
import { IFileStorage, IStreamableFS } from "./src/interfaces";
import { File } from "./src/types";
import { chunkPrefix } from "./src/utils";
import FileHandle from "./filehandle.js";
import { IFileStorage, IStreamableFS } from "./interfaces.js";
import { File } from "./types.js";
import { chunkPrefix } from "./utils.js";
export class StreamableFS implements IStreamableFS {
/**
@@ -81,3 +81,5 @@ export class StreamableFS implements IStreamableFS {
await this.storage.clear();
}
}
export type { IFileStorage, File, FileHandle };

View File

@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import FileHandle from "./filehandle";
import { File } from "./types";
import FileHandle from "./filehandle.js";
import { File } from "./types.js";
export interface IStreamableFS {
createFile(

View File

@@ -4,5 +4,5 @@
"lib": ["DOM", "ESNext"],
"outDir": "./dist"
},
"include": ["./index.ts", "./src/"]
"include": ["./src/"]
}