Created
February 18, 2023 01:07
-
-
Save Umisyus/087e6c057820010f5a27ddb3eced15fb 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 { Actor, log } from "apify"; | |
async function newFunction(FILE_SIZE = 5000000 /* Size in Megabytes */) { | |
await Actor.init(); | |
console.time() | |
let numbers = Array.from(([...Array(FILE_SIZE).keys()]).map((i) => i * 1)); | |
let zip = Buffer.from([...numbers]); | |
log.info(`zip size: ${zip.byteLength / 1000000} MB`); | |
await new Promise(async (resolve) => { | |
log.info(`Saving zip to KVS...`) | |
await Actor.setValue("TEST_FILE", zip, { contentType: "application/zip" }); | |
log.info(`Saved to KVS`); | |
resolve(); | |
}); | |
console.timeEnd() | |
}; | |
await newFunction(45_000_000) // Size is 45 MB |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment