How to use simple-download - 2 common examples

To help you get started, we’ve selected a few simple-download examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github splash-cli / splash-cli / src / extra / utils.js View on Github external
spinner.start();

	let filename = path.join(dir, `${photo.id}.jpg`);

	if (flags.save && isPath(flags.save)) {
		const savePath = pathFixer(flags.save);

		filename = path.join(savePath, `${photo.id}.jpg`);

		if (isImage(flags.save)) {
			filename = savePath;
		}
	}

	const remotePhoto = new RemoteFile(url, filename);

	remotePhoto.download().then(async (fileInfo) => {
		config.set('counter', config.get('counter') + 1);

		if (!flags.quiet) spinner.succeed();
		if (setAsWP && !flags.save) {
			if (flags.screen || flags.scale) {
				if (process.platform !== 'darwin') {
					console.log();
					logger.warn(
						chalk`{dim > Sorry, this function ({underline ${
							flags.screen ? '"screen"' : '"scale"'
						}}) is available {bold only on MacOS}}`,
					);
					console.log();
				}
github splash-cli / splash-cli / src / extra / utils.ts View on Github external
spinner.start();

	let filename = path.join(dir, `${photo.id}.jpg`);

	if (flags.save && isPath(flags.save)) {
		const savePath = pathFixer(flags.save);

		filename = path.join(savePath, `${photo.id}.jpg`);

		if (isImage(flags.save)) {
			filename = savePath;
		}
	}

	const remotePhoto = new RemoteFile(url, filename);

	const fileInfo = await remotePhoto.download();

	config.set("counter", config.get("counter") + 1);

	if (!flags.quiet) spinner.succeed();
	if (setAsWP && !flags.save) {
		if (flags.screen || flags.scale) {
			if (process.platform !== "darwin") {
				console.log();
				logger.warn(
					chalk`{dim > Sorry, this function ({underline ${
						flags.screen ? '"screen"' : '"scale"'
					}}) is available {bold only on MacOS}}`,
				);
				console.log();

simple-download

Simple Download

MIT
Latest version published 3 years ago

Package Health Score

42 / 100
Full package analysis

Popular simple-download functions

Similar packages