Skip to content

Instantly share code, notes, and snippets.

@Umisyus
Created February 18, 2023 01:07
Show Gist options
  • Save Umisyus/087e6c057820010f5a27ddb3eced15fb to your computer and use it in GitHub Desktop.
Save Umisyus/087e6c057820010f5a27ddb3eced15fb to your computer and use it in GitHub Desktop.
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