Quick start
Thanks to the Smash API Documentation, let's get started with the basics and make your first file uploads and downloads from the Smash API & SDK.
Step 1 - Register on Smash
To start uploading your first files with the Smash API, you need to create a Smash account on https://developer.fromsmash.com/signup. Registration is free. You will have a 100 GB, 14-day free trial (No credit card required).
Once your account is created, go to the “API Keys” section and generate your first API Key.
Step 2 - Make your first upload
In this example, install the Smash Uploader Node.js server-side SDK to get access to Smash APIs from applications written in Node.js.
We recommend installing the library with npm, a package manager for Node.
npm install @smash-sdk/uploader
Now that you have the Uploader Node.js SDK installed, you can start to create your first transfer from the example code below:
Code example:
Replace "Put an API key here" with your own.
import { SmashUploader } from "@smash-sdk/uploader";
const su = new SmashUploader({ region: "eu-west-3", token: "Put an API key here" })
const files = [
"./dummyFiles/dummy1.jpeg",
"./dummyFiles/dummy2.mp4",
"./dummyFiles/dummy3.pdf",
];
su.upload({ files }).then(transfer => {
console.log(transfer);
}).catch(error => {
console.log(error);
});
Step 3 - Make your first download
Once you have created your first files upload, you can start to create your first files download by installing the Smash Downloader Node.js server-side SDK to get access to Smash APIs from applications written in Node.js.
We recommend installing the library with npm, a package manager for Node.
npm install @smash-sdk/downloader
Now that you have the Downloader Node.js SDK installed, you can start to make your first transfer download from the example code below:
Code example:
Replace "Put an API key here" with your own.
import * as fs from 'fs'
import { SmashDownloader } from "@smash-sdk/downloader";
const sd1 = new SmashDownloader({
token: "Put your api key",
transferId: "Put a transfer id here",
path: "Path to file, ex: /dummyFiles/dummy.zip",
//enableOverride: true, // support for override
});
sd1.download().then(downloadedItem => {
console.log("Download", downloadedItem);
}).catch(error => {
console.log("Error", error);
});
ON THIS PAGE
Step 1 - Register on Smash
Step 2 - Make your first upload
Step 3 - Make your first downl…