How to use filenamify-url - 5 common examples

To help you get started, we’ve selected a few filenamify-url 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 sindresorhus / pageres / lib / index.js View on Github external
uri = path.basename(uri);
		}

		// Strip empty hash fragments: `#` `#/` `#!/`
		if (/^#!?\/?$/.test(hash)) {
			hash = '';
		}

		stream.filename = filename({
			crop: options.crop ? '-cropped' : '',
			date: easydate('Y-M-d'),
			time: easydate('h-m-s'),
			size,
			width: sizes[0],
			height: sizes[1],
			url: filenamifyUrl(uri) + filenamify(hash)
		});

		if (options.incrementalName) {
			stream.filename = unusedFilename.sync(stream.filename);
		}

		return stream;
	}
github sindresorhus / pageres / lib / util.js View on Github external
const sizes = size.split('x');
	const stream = screenshotStream(protocolify(uri), size, options);
	const filename = template(`${options.filename}.${options.format}`);

	if (path.isAbsolute(uri)) {
		uri = path.basename(uri);
	}

	stream.filename = filename({
		crop: options.crop ? '-cropped' : '',
		date: easydate('Y-M-d'),
		time: easydate('h-m-s'),
		size,
		width: sizes[0],
		height: sizes[1],
		url: filenamifyUrl(uri)
	});

	return stream;
}
github machawk1 / wail / wail-archiver / index.js View on Github external
extractedSeedWarcPath (seed, forCol) {
    return path.join(
      this._swapper.setValue(this._settings.get('collections.colWarcs')).template({col: forCol}, '{', '}').s,
      `${filenamifyUrl(seed)}-${forCol}-${new Date().getTime()}.warc`
    )
  }
github machawk1 / wail / wail-ui / components / collections / addToCollection / fromLiveWeb / archiveUrlForm.js View on Github external
const archive = (forCol, config) => {
  let message = `Archiving ${config.get('url')} for ${forCol} Now!`
  let conf = config.get('config')
  let rconf
  if (conf.charAt(0) === 'p') {
    let saveThisOne = `${filenamifyUrl(config.get('url'))}-${forCol}-${new Date().getTime()}.warc`
    rconf = {
      forCol,
      jobId: uuidv1(),
      type: conf,
      uri_r: config.get('url'),
      saveTo: path.join(S(settings.get('collections.colWarcs')).template({col: forCol}).s, saveThisOne),
      isPartOfV: forCol,
      description: `Archived by WAIL for ${forCol}`
    }
    ipc.send(ipcChannels.ARCHIVE_WITH_WAIL, rconf)
  } else {
    ipc.send(ipcChannels.ARCHIVE_WITH_HERITRIX, {
      urls: config.get('url'),
      depth: parseInt(conf[1]),
      jobId: new Date().getTime(),
      forCol
github cardstack / cardstack / packages / git / service.ts View on Github external
async _makeRepo(remote: RemoteConfig) {
    let cacheDirectory = remote.cacheDir;

    if (!cacheDirectory) {
      cacheDirectory = join(tmpdir(), 'cardstack-git-local-cache');

      if (!existsSync(cacheDirectory)) {
        await mkdirp(cacheDirectory);
      }
    }

    let repoPath = join(cacheDirectory, filenamifyUrl(remote.url));

    let fetchOpts = {
      callbacks: {
        credentials: (url: string, userName: string) => {
          if (remote.privateKey) {
            return Cred.sshKeyMemoryNew(userName, remote.publicKey || '', remote.privateKey, remote.passphrase || '');
          }
          return Cred.sshKeyFromAgent(userName);
        },
      },
    };

    log.info('creating local repo cache for %s in %s', remote.url, repoPath);

    let repo;

filenamify-url

Convert a URL to a valid filename

MIT
Latest version published 5 months ago

Package Health Score

70 / 100
Full package analysis

Popular filenamify-url functions