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/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import FileStreamSource from "./filestreamsource"; import FileStreamSource from "./filestreamsource.js";
import { IFileStorage } from "./interfaces"; import { IFileStorage } from "./interfaces.js";
import { File } from "./types"; import { File } from "./types.js";
import { chunkPrefix } from "./utils"; import { chunkPrefix } from "./utils.js";
export default class FileHandle { export default class FileHandle {
constructor( 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/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { File } from "./types"; import { File } from "./types.js";
import { IFileStorage } from "./interfaces"; import { IFileStorage } from "./interfaces.js";
export default class FileStreamSource { export default class FileStreamSource {
private index = 0; 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/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import FileHandle from "./src/filehandle"; import FileHandle from "./filehandle.js";
import { IFileStorage, IStreamableFS } from "./src/interfaces"; import { IFileStorage, IStreamableFS } from "./interfaces.js";
import { File } from "./src/types"; import { File } from "./types.js";
import { chunkPrefix } from "./src/utils"; import { chunkPrefix } from "./utils.js";
export class StreamableFS implements IStreamableFS { export class StreamableFS implements IStreamableFS {
/** /**
@@ -81,3 +81,5 @@ export class StreamableFS implements IStreamableFS {
await this.storage.clear(); 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/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import FileHandle from "./filehandle"; import FileHandle from "./filehandle.js";
import { File } from "./types"; import { File } from "./types.js";
export interface IStreamableFS { export interface IStreamableFS {
createFile( createFile(

View File

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