1.3.3 • Published 3 years ago
m3dia v1.3.3
Installing
Using npm:
$ npm install m3diaPerforming a GET TOKEN request
var m3dia = require('m3dia');
var m3 = new m3dia({
server: 'https://m3dia.gostream.co',
user: {
username: 'username',
password: '123456'
}
});
(async () => {
try {
var token = await m3.getToken();
console.log(token);
} catch (e) {
// Deal with the fact the chain failed
}
})();Performing a SET TOKEN request
If you have a long time token, instead get token via username and password, you can set it to use.
var m3dia = require('m3dia');
var m3 = new m3dia({
server: 'https://m3dia.gostream.co',
token: 'your-long-time-token',
});
(async () => {
try {
var data = new FormData();
data.append('media', fs.createReadStream('/path/to/your/file/filename.mov'));
data.append('is_convert', 'false');// if you don't need convert to mp4 faststart
var file = await m3.upload(data);
console.log("Files: ", file);
} catch (e) {
// Deal with the fact the chain failed
}
})();Performing a UPLOAD request
var FormData = require('form-data');
var fs = require('fs');
var m3dia = require('m3dia');
var m3 = new m3dia({
server: 'https://m3dia.gostream.co',
user: {
username: 'username',
password: '123456'
}
});
(async () => {
try {
await m3.getToken();
var data = new FormData();
data.append('media', fs.createReadStream('/path/to/your/file/filename.mov'));
data.append('is_convert', 'false');// if you don't need convert to mp4 faststart
var file = await m3.upload(data);
console.log("Files: ", file);
} catch (e) {
// Deal with the fact the chain failed
}
})();Performing a CHUNKING UPLOAD request
var m3 = new m3dia({
server: 'https://m3dia.gostream.co',
user: {
username: 'username',
password: '123456'
},
maxActiveChunk: 5, //default 3
});
(async () => {
try {
await m3.getToken();
var file = await m3.chunkUpload('/path/to/your/file/filename.mov');
//or if you don't need convert to mp4 faststart
// var file = await m3.chunkUpload('/path/to/your/file/filename.mov', 'false');
// if you need use transcode to 480p
// var file = await m3.chunkUpload('/path/to/your/file/filename.mov', {isConvert: 'true', isTranscode:'true'});
console.log("\nFiles: ", file);
} catch (e) {
// Deal with the fact the chain failed
}
})();Performing a GET FILE STATUS request
(async () => {
try {
var stt = await m3.getFileStatus([String]fileId)
console.log("Status: ", stt);
} catch (e) {
// Deal with the fact the chain failed
}
})();Performing a GET URI request
(async () => {
try {
console.log("Files: ", m3.getUri([String]enpoit));
} catch (e) {
// Deal with the fact the chain failed
}
})();Performing a DELETE FILE request
(async () => {
try {
var del = await m3.deleteFile([String]fileId)
console.log("Delete: ", del.data);
} catch (e) {
// Deal with the fact the chain failed
}
})();Performing a GET M3DIA LINK FROM YOUTUBE VIDEO ID request
(async () => {
try {
var file = await m3.youtubeDownload('your-youtube-id');
console.log("File: ", file);
} catch (e) {
// Deal with the fact the chain failed
}
})();Performing a GET M3DIA LINK FROM FACEBOOK VIDEO URL request
(async () => {
try {
var file = await m3.facebookDownload('your-facebook-video-url');
console.log("File: ", file);
} catch (e) {
// Deal with the fact the chain failed
}
})();1.3.3
3 years ago
1.3.2
3 years ago
1.3.1
4 years ago
1.3.0
4 years ago
1.2.9
5 years ago
1.2.8
5 years ago
1.2.7
5 years ago
1.2.6
5 years ago
1.2.5
5 years ago
1.2.4
5 years ago
1.2.3
5 years ago
1.2.2
5 years ago
1.2.1
5 years ago
1.2.0
5 years ago
1.1.1
5 years ago
1.0.2
5 years ago
1.0.1
5 years ago
1.1.3
5 years ago
1.1.2
5 years ago
1.0.0
5 years ago