Update index.js
Browse files
index.js
CHANGED
|
@@ -260,7 +260,6 @@ async function streamToBuffer(stream) {
|
|
| 260 |
return Buffer.concat(chunks);
|
| 261 |
}
|
| 262 |
async function fileDitch(media, ext){
|
| 263 |
-
return new Promise(async (resolve, reject) => {
|
| 264 |
let {fileTypeFromBuffer} = await (await import('file-type'))
|
| 265 |
let mime = await fileTypeFromBuffer(media)
|
| 266 |
let form = new FormData()
|
|
@@ -283,8 +282,7 @@ async function fileDitch(media, ext){
|
|
| 283 |
"Referrer-Policy": "strict-origin-when-cross-origin",
|
| 284 |
...form.getHeaders()
|
| 285 |
}
|
| 286 |
-
}).then(({ data }) => { console.log(data);
|
| 287 |
-
})
|
| 288 |
//https://up1.fileditch.com/upload.php
|
| 289 |
}
|
| 290 |
async function ytAPI(url) {
|
|
|
|
| 260 |
return Buffer.concat(chunks);
|
| 261 |
}
|
| 262 |
async function fileDitch(media, ext){
|
|
|
|
| 263 |
let {fileTypeFromBuffer} = await (await import('file-type'))
|
| 264 |
let mime = await fileTypeFromBuffer(media)
|
| 265 |
let form = new FormData()
|
|
|
|
| 282 |
"Referrer-Policy": "strict-origin-when-cross-origin",
|
| 283 |
...form.getHeaders()
|
| 284 |
}
|
| 285 |
+
}).then(async ({ data }) => { console.log(data); return data?.files[0]?.url}).catch(e => {return null})
|
|
|
|
| 286 |
//https://up1.fileditch.com/upload.php
|
| 287 |
}
|
| 288 |
async function ytAPI(url) {
|