-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
25 lines (20 loc) · 629 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
'use strict';
const {createReadStream} = require('fs');
const action = async context => {
const uploadEndpoint = 'https://transfer.sh/' + context.defaultFileName;
const filePath = await context.filePath();
context.setProgress('Uploading…');
const response = await context.request(uploadEndpoint, {
method: 'put',
body: createReadStream(filePath)
});
context.copyToClipboard(response.body);
context.notify('URL to the file has been copied to the clipboard');
};
const transfer = {
title: 'Share on Transfer',
formats: ['gif', 'mp4', 'webm', 'apng'],
action,
config: {}
};
exports.shareServices = [transfer];