()
| 66 | * been created. |
| 67 | */ |
| 68 | create() { |
| 69 | return createTempDir({ |
| 70 | prefix: 'tmp-web-ext-', |
| 71 | // This allows us to remove a non-empty tmp dir. |
| 72 | unsafeCleanup: true, |
| 73 | }).then(([tmpPath, removeTempDir]) => { |
| 74 | this._path = tmpPath; |
| 75 | this._removeTempDir = () => |
| 76 | new Promise((resolve, reject) => { |
| 77 | // `removeTempDir` parameter is a `next` callback which |
| 78 | // is called once the dir has been removed. |
| 79 | const next = (err) => (err ? reject(err) : resolve()); |
| 80 | removeTempDir(next); |
| 81 | }); |
| 82 | log.debug(`Created temporary directory: ${this.path()}`); |
| 83 | return this; |
| 84 | }); |
| 85 | } |
| 86 | |
| 87 | /* |
| 88 | * Get the absolute path of the temp directory. |
no test coverage detected