This documentation provides the usage of @filego/js
.
Install @filego/js
as a dependency:
npm:
npm i @filego/js
Yarn:
yarn add @filego/js
pnpm:
pnpm add @filego/js
@filego/js
provides the following functions:
This function splits file into chunks, and the chunks can be used to check and merge later. It will return the chunks
, fileSize
and totalChunks
.
import { split } from "@filego/js";
const file: File | Blob | Uint8Array | string = "";
await split({
file,
chunkSize: 2 * 1024 * 1024,
});
This function checks file integrity by verifying the chunks
with fileSize
and totalChunks
parameters. It will return the status
and the error
of the check.
import { check } from "@filego/js";
await check({
chunks: [], // result from split function...
fileSize: 0, // result from split function...
totalChunks: 0, // result from split function...
});
This function merges the chunks by using the chunks
parameters. It will return the blob
of the merged file.
import { merge } from "@filego/js";
await merge({
chunks: [], // result from split function...
});