source: trip-planner-front/node_modules/karma/lib/temp_dir.js@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 594 bytes
Line 
1'use strict'
2
3const path = require('path')
4const fs = require('graceful-fs')
5const rimraf = require('rimraf')
6const log = require('./logger').create('temp-dir')
7
8const TEMP_DIR = require('os').tmpdir()
9
10module.exports = {
11 getPath (suffix) {
12 return path.normalize(TEMP_DIR + suffix)
13 },
14
15 create (path) {
16 log.debug(`Creating temp dir at ${path}`)
17
18 try {
19 fs.mkdirSync(path)
20 } catch (e) {
21 log.warn(`Failed to create a temp dir at ${path}`)
22 }
23
24 return path
25 },
26
27 remove (path, done) {
28 log.debug(`Cleaning temp dir ${path}`)
29 rimraf(path, done)
30 }
31}
Note: See TracBrowser for help on using the repository browser.