How to use the tmp-promise.tmpName function in tmp-promise

To help you get started, we’ve selected a few tmp-promise 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 ZhangZisu / ZenOnlineJudge / models / file.js View on Github external
static async zipFiles(files) {
		let tmp = require('tmp-promise');
		let dir = await tmp.dir(), path = require('path'), fs = require('fs-extra');
		let filenames = await files.mapAsync(async file => {
			let fullPath = path.join(dir.path, file.filename);
			await fs.writeFileAsync(fullPath, file.data);
			return fullPath;
		});

		let p7zip = new (require('node-7z')), zipFile = await tmp.tmpName() + '.zip';
		await p7zip.add(zipFile, filenames);

		await fs.removeAsync(dir.path);

		return zipFile;
	}
github SynBioHub / synbiohub / lib / fetch / remote / ice / fetch-sbol-source.js View on Github external
return fetchSBOLObjectRecursive(remoteConfig, new SBOLDocument(), type, objectUri).then((res) => {
    return tmp.tmpName().then((tmpFilename) => {
      return fs.writeFile(tmpFilename, serializeSBOL(res.sbol))
        .then(() => Promise.resolve(tmpFilename))
    })
  })
}
github SynBioHub / synbiohub / lib / actions / cloneSubmission.js View on Github external
function saveTempFile () {
    return tmp.tmpName().then((tmpFilename) => {
      return fs.writeFile(tmpFilename, serializeSBOL(sbol)).then(() => {
        return Promise.resolve(tmpFilename)
      })
    })
  }
github SynBioHub / synbiohub / lib / api / gff3.js View on Github external
function saveTempFile () {
    return tmp.tmpName().then((tmpFilename) => {
      return fs.writeFile(tmpFilename, serializeSBOL(sbol)).then(() => {
        return Promise.resolve(tmpFilename)
      })
    })
  }
github SynBioHub / synbiohub / lib / fetch / local / fetch-sbol-source.js View on Github external
return fetchSBOLObjectRecursive(sbol, type, objectUri, graphUri).then((res) => {
        return tmp.tmpName().then((tmpFilename) => {
          return fs.writeFile(tmpFilename, serializeSBOL(res.sbol))
            .then(() => Promise.resolve(tmpFilename))
        })
      })
    }
github gsuitedevs / md2googleslides / src / generate_image.js View on Github external
async function renderSVG(image) {
    debug('Generating SVG', image);
    let path = await tmp.tmpName({ postfix: '.png' });
    let buffer = Buffer.from(image.source);
    try {
        let result = await sharp(buffer, { density: 2400 } ).png().toFile(path);
    } catch(e) {
        throw e;
    }
    return path;
}
github SynBioHub / synbiohub / lib / fetch / local / fetch-sbol-source-non-recursive.js View on Github external
return fetchSBOLObjectNonRecursive(sbol, type, uri, graphUri).then((res) => {
        return tmp.tmpName().then((tmpFilename) => {
          return fs.writeFile(tmpFilename, serializeSBOL(res.sbol))
            .then(() => Promise.resolve(tmpFilename))
        })
      })
    } else {
github SynBioHub / synbiohub / lib / actions / makePublic.js View on Github external
function saveTempFile () {
    return tmp.tmpName().then((tmpFilename) => {
      return fs.writeFile(tmpFilename, serializeSBOL(sbol)).then(() => {
        return Promise.resolve(tmpFilename)
      })
    })
  }
github SynBioHub / synbiohub / lib / api / genBank.js View on Github external
function saveTempFile () {
    return tmp.tmpName().then((tmpFilename) => {
      return fs.writeFile(tmpFilename, serializeSBOL(sbol)).then(() => {
        return Promise.resolve(tmpFilename)
      })
    })
  }

tmp-promise

The tmp package with promises support and disposers.

MIT
Latest version published 3 years ago

Package Health Score

73 / 100
Full package analysis