16 lines
433 B
JavaScript
16 lines
433 B
JavaScript
|
const axios = require('axios');
|
||
|
|
||
|
async function create_image(host, access_token, file_path) {
|
||
|
axios.post(`${host}/api/drive/files/create`, {
|
||
|
file: fs.createReadStream(file_path)
|
||
|
}, {
|
||
|
headers: {
|
||
|
'Content-Type': 'multipart/form-data',
|
||
|
'Authorization': `Bearer ${access_token}`
|
||
|
}
|
||
|
}).then((data) => {
|
||
|
return data;
|
||
|
});
|
||
|
};
|
||
|
|
||
|
module.exports.create_image = create_image;
|