Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import fetch from "node-fetch";
import sharp from "sharp";
import config from "./config.js";
import createSaveImageJob from "./util/createSaveImageJob.js";
const require = createRequire(import.meta.url);
const {
FileDownloadManager,
FileRecord,
MongoFileCollection,
TempFileStore,
RemoteUrlWorker,
TempFileStoreWorker
} = require("@reactioncommerce/file-collections");
const GridFSStore = require("@reactioncommerce/file-collections-sa-gridfs").default;
/**
* @returns {undefined}
*/
export default function setUpFileCollections({
absoluteUrlPrefix,
context,
db,
Logger,
MediaRecords,
mongodb
}) {
FileRecord.downloadEndpointPrefix = "/assets/files";
FileRecord.absoluteUrlPrefix = absoluteUrlPrefix;
// 1024*1024*2 is the GridFSStore default chunk size, and 256k is default GridFS chunk size, but performs terribly