diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2018-08-27 13:28:49 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-27 16:03:57 +0200 |
commit | c9d5c64f98c1f1fe7950de60c58edeaf3ace070d (patch) | |
tree | 26d828e560054cf8a64628823d3dd86172d44f52 /server/helpers | |
parent | 0ee027347ae09ea397e9b85702707e9179537ebd (diff) | |
download | PeerTube-c9d5c64f98c1f1fe7950de60c58edeaf3ace070d.tar.gz PeerTube-c9d5c64f98c1f1fe7950de60c58edeaf3ace070d.tar.zst PeerTube-c9d5c64f98c1f1fe7950de60c58edeaf3ace070d.zip |
replace fs by fs-extra to prevent EMFILE error
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/captions-utils.ts | 2 | ||||
-rw-r--r-- | server/helpers/core-utils.ts | 3 | ||||
-rw-r--r-- | server/helpers/logger.ts | 4 | ||||
-rw-r--r-- | server/helpers/requests.ts | 2 | ||||
-rw-r--r-- | server/helpers/webtorrent.ts | 2 |
5 files changed, 6 insertions, 7 deletions
diff --git a/server/helpers/captions-utils.ts b/server/helpers/captions-utils.ts index 8b04f878d..20c9fe5aa 100644 --- a/server/helpers/captions-utils.ts +++ b/server/helpers/captions-utils.ts | |||
@@ -3,7 +3,7 @@ import { join } from 'path' | |||
3 | import { CONFIG } from '../initializers' | 3 | import { CONFIG } from '../initializers' |
4 | import { VideoCaptionModel } from '../models/video/video-caption' | 4 | import { VideoCaptionModel } from '../models/video/video-caption' |
5 | import * as srt2vtt from 'srt-to-vtt' | 5 | import * as srt2vtt from 'srt-to-vtt' |
6 | import { createReadStream, createWriteStream } from 'fs' | 6 | import { createReadStream, createWriteStream } from 'fs-extra' |
7 | 7 | ||
8 | async function moveAndProcessCaptionFile (physicalFile: { filename: string, path: string }, videoCaption: VideoCaptionModel) { | 8 | async function moveAndProcessCaptionFile (physicalFile: { filename: string, path: string }, videoCaption: VideoCaptionModel) { |
9 | const videoCaptionsDir = CONFIG.STORAGE.CAPTIONS_DIR | 9 | const videoCaptionsDir = CONFIG.STORAGE.CAPTIONS_DIR |
diff --git a/server/helpers/core-utils.ts b/server/helpers/core-utils.ts index 90d2cd9b3..9830d41a8 100644 --- a/server/helpers/core-utils.ts +++ b/server/helpers/core-utils.ts | |||
@@ -6,8 +6,7 @@ | |||
6 | import * as bcrypt from 'bcrypt' | 6 | import * as bcrypt from 'bcrypt' |
7 | import * as createTorrent from 'create-torrent' | 7 | import * as createTorrent from 'create-torrent' |
8 | import { createHash, pseudoRandomBytes } from 'crypto' | 8 | import { createHash, pseudoRandomBytes } from 'crypto' |
9 | import { copyFile, readdir, readFile, rename, stat, Stats, unlink, writeFile } from 'fs' | 9 | import { copyFile, readdir, readFile, rename, stat, Stats, unlink, writeFile, mkdirp } from 'fs-extra' |
10 | import * as mkdirp from 'mkdirp' | ||
11 | import { isAbsolute, join } from 'path' | 10 | import { isAbsolute, join } from 'path' |
12 | import * as pem from 'pem' | 11 | import * as pem from 'pem' |
13 | import * as rimraf from 'rimraf' | 12 | import * as rimraf from 'rimraf' |
diff --git a/server/helpers/logger.ts b/server/helpers/logger.ts index 480c5b49e..ce6e38f15 100644 --- a/server/helpers/logger.ts +++ b/server/helpers/logger.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | // Thanks http://tostring.it/2014/06/23/advanced-logging-with-nodejs/ | 1 | // Thanks http://tostring.it/2014/06/23/advanced-logging-with-nodejs/ |
2 | import * as mkdirp from 'mkdirp' | 2 | import { mkdirpSync } from 'fs-extra' |
3 | import * as path from 'path' | 3 | import * as path from 'path' |
4 | import * as winston from 'winston' | 4 | import * as winston from 'winston' |
5 | import { CONFIG } from '../initializers' | 5 | import { CONFIG } from '../initializers' |
@@ -7,7 +7,7 @@ import { CONFIG } from '../initializers' | |||
7 | const label = CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT | 7 | const label = CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT |
8 | 8 | ||
9 | // Create the directory if it does not exist | 9 | // Create the directory if it does not exist |
10 | mkdirp.sync(CONFIG.STORAGE.LOG_DIR) | 10 | mkdirpSync(CONFIG.STORAGE.LOG_DIR) |
11 | 11 | ||
12 | function loggerReplacer (key: string, value: any) { | 12 | function loggerReplacer (key: string, value: any) { |
13 | if (value instanceof Error) { | 13 | if (value instanceof Error) { |
diff --git a/server/helpers/requests.ts b/server/helpers/requests.ts index 64e3ce663..ee9e80404 100644 --- a/server/helpers/requests.ts +++ b/server/helpers/requests.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import * as Bluebird from 'bluebird' | 1 | import * as Bluebird from 'bluebird' |
2 | import { createWriteStream } from 'fs' | 2 | import { createWriteStream } from 'fs-extra' |
3 | import * as request from 'request' | 3 | import * as request from 'request' |
4 | import { ACTIVITY_PUB } from '../initializers' | 4 | import { ACTIVITY_PUB } from '../initializers' |
5 | 5 | ||
diff --git a/server/helpers/webtorrent.ts b/server/helpers/webtorrent.ts index 6f2adb3cb..1c0d00d70 100644 --- a/server/helpers/webtorrent.ts +++ b/server/helpers/webtorrent.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { logger } from './logger' | 1 | import { logger } from './logger' |
2 | import { generateVideoTmpPath } from './utils' | 2 | import { generateVideoTmpPath } from './utils' |
3 | import * as WebTorrent from 'webtorrent' | 3 | import * as WebTorrent from 'webtorrent' |
4 | import { createWriteStream } from 'fs' | 4 | import { createWriteStream } from 'fs-extra' |
5 | import { CONFIG } from '../initializers' | 5 | import { CONFIG } from '../initializers' |
6 | import { join } from 'path' | 6 | import { join } from 'path' |
7 | import { unlinkPromise } from './core-utils' | 7 | import { unlinkPromise } from './core-utils' |