Created
July 18, 2023 06:21
-
-
Save optlsnd/7a800e95afe57f87f13cfe798513e3c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
listOfFiles, | |
UploadcareSimpleAuthSchema, | |
paginate, | |
} from "@uploadcare/rest-client"; | |
const uploadcareSimpleAuthSchema = new UploadcareSimpleAuthSchema({ | |
publicKey: process.env.UC_PUBLIC_KEY, | |
secretKey: process.env.UC_SECRET_KEY, | |
}); | |
const paginatedListOfFiles = paginate(listOfFiles); | |
const pages = paginatedListOfFiles( | |
{ removed: false, limit: 1000 }, | |
{ authSchema: uploadcareSimpleAuthSchema } | |
); | |
// List files and filter out videos with `variations` metadata | |
for await (const page of pages) { | |
page.results.forEach((file) => { | |
if (file.mimeType.indexOf("video") > -1 && file.variations !== null) { | |
console.log(file.uuid); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment