2.0.0 • Published 3 years ago

slicer-file v2.0.0

Weekly downloads
19
License
GPL-3.0
Repository
github
Last release
3 years ago

Slicer-File

GitHub GitHub package.json version


This library allows you to upload files in chunks.


import { slicer, support } from "slicer";

const url = "url";
const headers = {};
const file = {};
const size = 1024 * 1024;
const data = {
  user: "1",
  date: new Date(),
};
let callback = () => {};
let stopFlag = {
  stop: true,
};
if (support()) {
  slicer(url, headers, file, size, data, callback, stopFlag);
}

URL:

  • url + /status — checking how many bytes have already been uploaded to the server.
  • url + /upload — loading a file with chunks.

Parameters:

  • url — url of the server
  • headers — request headers
  • file — the file that you want to transfer
  • size — the size of the chunk
  • data — information to be transmitted with the file
  • callback — the function that is called when the chunk is successfully sent
  • stopFlag — the object that needs to be changed in order to stop sending the file

Callback:

  • name
  • progress
  • id
  • data
2.0.0

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago