Data Types

Get Started

Bytescale simplifies file uploading, file processing, content optimization, and content delivery.

Install the JavaScript SDK to upload files without a UI:

1<html>
2 <head>
3 <script src="https://js.bytescale.com/sdk/v3"></script>
4 <script>
5 // import * as Bytescale from "@bytescale/sdk";
6 const uploadManager = new Bytescale.UploadManager({
7 apiKey: "free" // Get API key: https://www.bytescale.com/get-started
8 });
9
10 const onFileSelected = async event => {
11 const file = event.target.files[0];
12 try {
13 const { fileUrl, filePath } = await uploadManager.upload({ data: file });
14 alert(`File uploaded:\n${fileUrl}`);
15 } catch (e: any) {
16 alert(`Error:\n${e.message}`);
17 }
18 }
19 </script>
20 </head>
21 <body>
22 <input type="file" onchange="onFileSelected(event)" />
23 </body>
24</html>

Or with NPM:

npm install @bytescale/sdk
import * as Bytescale from "@bytescale/sdk";
const uploadManager = new Bytescale.UploadManager({
apiKey: "free" // Get API key: https://www.bytescale.com/get-started
});
const onFileSelected = async event => {
const file = event.target.files[0];
try {
const { fileUrl, filePath } = await uploadManager.upload({ data: file });
alert(`File uploaded:\n${fileUrl}`);
} catch (e: any) {
alert(`Error:\n${e.message}`);
}
}
//
// <input type="file" onchange="onFileSelected(event)" />
//

The Upload Widget (our ready-made UI component) supports these web frameworks:

The JavaScript SDK (our headless library) supports browsers & Node.js:

Learn more about downloading and processing files:

Was this section helpful? Yes No

You are using an outdated browser.

This website requires a modern web browser -- the latest versions of these browsers are supported: