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 | |
parent | 0ee027347ae09ea397e9b85702707e9179537ebd (diff) | |
download | PeerTube-c9d5c64f98c1f1fe7950de60c58edeaf3ace070d.tar.gz PeerTube-c9d5c64f98c1f1fe7950de60c58edeaf3ace070d.tar.zst PeerTube-c9d5c64f98c1f1fe7950de60c58edeaf3ace070d.zip |
replace fs by fs-extra to prevent EMFILE error
-rw-r--r-- | package.json | 2 | ||||
-rwxr-xr-x | scripts/generate-code-contributors.ts | 2 | ||||
-rwxr-xr-x | scripts/i18n/create-custom-files.ts | 2 | ||||
-rwxr-xr-x | scripts/i18n/xliff2json.ts | 2 | ||||
-rwxr-xr-x | scripts/parse-log.ts | 2 | ||||
-rw-r--r-- | server/controllers/static.ts | 2 | ||||
-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 | ||||
-rw-r--r-- | server/initializers/migrations/0065-video-file-size.ts | 2 | ||||
-rw-r--r-- | server/lib/cache/abstract-video-static-file-cache.ts | 2 | ||||
-rw-r--r-- | server/lib/emailer.ts | 2 | ||||
-rw-r--r-- | server/lib/schedulers/youtube-dl-update-scheduler.ts | 2 | ||||
-rw-r--r-- | server/tests/utils/users/accounts.ts | 2 | ||||
-rw-r--r-- | server/tests/utils/videos/videos.ts | 2 | ||||
-rw-r--r-- | server/tools/upload.ts | 2 |
18 files changed, 19 insertions, 20 deletions
diff --git a/package.json b/package.json index 3f4e272ec..635ceaf76 100644 --- a/package.json +++ b/package.json | |||
@@ -100,6 +100,7 @@ | |||
100 | "express-validator": "^5.0.0", | 100 | "express-validator": "^5.0.0", |
101 | "flat": "^4.1.0", | 101 | "flat": "^4.1.0", |
102 | "fluent-ffmpeg": "^2.1.0", | 102 | "fluent-ffmpeg": "^2.1.0", |
103 | "fs-extra": "^7.0.0", | ||
103 | "helmet": "^3.12.1", | 104 | "helmet": "^3.12.1", |
104 | "ip-anonymize": "^0.0.6", | 105 | "ip-anonymize": "^0.0.6", |
105 | "ipaddr.js": "https://github.com/whitequark/ipaddr.js.git#8e69afeb4053ee32447a101845f860848280eca5", | 106 | "ipaddr.js": "https://github.com/whitequark/ipaddr.js.git#8e69afeb4053ee32447a101845f860848280eca5", |
@@ -110,7 +111,6 @@ | |||
110 | "jsonld-signatures": "https://github.com/Chocobozzz/jsonld-signatures#rsa2017", | 111 | "jsonld-signatures": "https://github.com/Chocobozzz/jsonld-signatures#rsa2017", |
111 | "lodash": "^4.17.10", | 112 | "lodash": "^4.17.10", |
112 | "magnet-uri": "^5.1.4", | 113 | "magnet-uri": "^5.1.4", |
113 | "mkdirp": "^0.5.1", | ||
114 | "morgan": "^1.5.3", | 114 | "morgan": "^1.5.3", |
115 | "multer": "^1.1.0", | 115 | "multer": "^1.1.0", |
116 | "nodemailer": "^4.4.2", | 116 | "nodemailer": "^4.4.2", |
diff --git a/scripts/generate-code-contributors.ts b/scripts/generate-code-contributors.ts index 0cce62180..3d37372d1 100755 --- a/scripts/generate-code-contributors.ts +++ b/scripts/generate-code-contributors.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { doRequest } from '../server/helpers/requests' | 1 | import { doRequest } from '../server/helpers/requests' |
2 | import { readFileSync } from 'fs' | 2 | import { readFileSync } from 'fs-extra' |
3 | 3 | ||
4 | run() | 4 | run() |
5 | .then(() => process.exit(0)) | 5 | .then(() => process.exit(0)) |
diff --git a/scripts/i18n/create-custom-files.ts b/scripts/i18n/create-custom-files.ts index c4f8411e1..eed3182a6 100755 --- a/scripts/i18n/create-custom-files.ts +++ b/scripts/i18n/create-custom-files.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import * as jsToXliff12 from 'xliff/jsToXliff12' | 1 | import * as jsToXliff12 from 'xliff/jsToXliff12' |
2 | import { writeFile } from 'fs' | 2 | import { writeFile } from 'fs-extra' |
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import { | 4 | import { |
5 | buildLanguages, | 5 | buildLanguages, |
diff --git a/scripts/i18n/xliff2json.ts b/scripts/i18n/xliff2json.ts index ed6854514..7e6de2893 100755 --- a/scripts/i18n/xliff2json.ts +++ b/scripts/i18n/xliff2json.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import * as xliff12ToJs from 'xliff/xliff12ToJs' | 1 | import * as xliff12ToJs from 'xliff/xliff12ToJs' |
2 | import { readFileSync, unlink, writeFile } from 'fs' | 2 | import { readFileSync, unlink, writeFile } from 'fs-extra' |
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import { buildFileLocale, I18N_LOCALES, isDefaultLocale } from '../../shared/models/i18n/i18n' | 4 | import { buildFileLocale, I18N_LOCALES, isDefaultLocale } from '../../shared/models/i18n/i18n' |
5 | import { eachSeries } from 'async' | 5 | import { eachSeries } from 'async' |
diff --git a/scripts/parse-log.ts b/scripts/parse-log.ts index d22e90266..86aaa7994 100755 --- a/scripts/parse-log.ts +++ b/scripts/parse-log.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import * as program from 'commander' | 1 | import * as program from 'commander' |
2 | import { createReadStream, readdirSync, statSync } from 'fs' | 2 | import { createReadStream, readdirSync, statSync } from 'fs-extra' |
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import { createInterface } from 'readline' | 4 | import { createInterface } from 'readline' |
5 | import * as winston from 'winston' | 5 | import * as winston from 'winston' |
diff --git a/server/controllers/static.ts b/server/controllers/static.ts index 2a92810f3..6e8f1a07f 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import * as cors from 'cors' | 1 | import * as cors from 'cors' |
2 | import { createReadStream } from 'fs' | 2 | import { createReadStream } from 'fs-extra' |
3 | import * as express from 'express' | 3 | import * as express from 'express' |
4 | import { CONFIG, STATIC_DOWNLOAD_PATHS, STATIC_MAX_AGE, STATIC_PATHS, ROUTE_CACHE_LIFETIME } from '../initializers' | 4 | import { CONFIG, STATIC_DOWNLOAD_PATHS, STATIC_MAX_AGE, STATIC_PATHS, ROUTE_CACHE_LIFETIME } from '../initializers' |
5 | import { VideosPreviewCache } from '../lib/cache' | 5 | import { VideosPreviewCache } from '../lib/cache' |
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' |
diff --git a/server/initializers/migrations/0065-video-file-size.ts b/server/initializers/migrations/0065-video-file-size.ts index 4e2075f8b..66f25016a 100644 --- a/server/initializers/migrations/0065-video-file-size.ts +++ b/server/initializers/migrations/0065-video-file-size.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import * as Sequelize from 'sequelize' |
2 | import * as Promise from 'bluebird' | 2 | import * as Promise from 'bluebird' |
3 | import { stat } from 'fs' | 3 | import { stat } from 'fs-extra' |
4 | import { VideoModel } from '../../models/video/video' | 4 | import { VideoModel } from '../../models/video/video' |
5 | 5 | ||
6 | function up (utils: { | 6 | function up (utils: { |
diff --git a/server/lib/cache/abstract-video-static-file-cache.ts b/server/lib/cache/abstract-video-static-file-cache.ts index 8e895cc82..3e20c5d2a 100644 --- a/server/lib/cache/abstract-video-static-file-cache.ts +++ b/server/lib/cache/abstract-video-static-file-cache.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import * as AsyncLRU from 'async-lru' | 1 | import * as AsyncLRU from 'async-lru' |
2 | import { createWriteStream } from 'fs' | 2 | import { createWriteStream } from 'fs-extra' |
3 | import { unlinkPromise } from '../../helpers/core-utils' | 3 | import { unlinkPromise } from '../../helpers/core-utils' |
4 | import { logger } from '../../helpers/logger' | 4 | import { logger } from '../../helpers/logger' |
5 | import { VideoModel } from '../../models/video/video' | 5 | import { VideoModel } from '../../models/video/video' |
diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts index c8398c9e7..bf8e5b6c3 100644 --- a/server/lib/emailer.ts +++ b/server/lib/emailer.ts | |||
@@ -7,7 +7,7 @@ import { UserModel } from '../models/account/user' | |||
7 | import { VideoModel } from '../models/video/video' | 7 | import { VideoModel } from '../models/video/video' |
8 | import { JobQueue } from './job-queue' | 8 | import { JobQueue } from './job-queue' |
9 | import { EmailPayload } from './job-queue/handlers/email' | 9 | import { EmailPayload } from './job-queue/handlers/email' |
10 | import { readFileSync } from 'fs' | 10 | import { readFileSync } from 'fs-extra' |
11 | 11 | ||
12 | class Emailer { | 12 | class Emailer { |
13 | 13 | ||
diff --git a/server/lib/schedulers/youtube-dl-update-scheduler.ts b/server/lib/schedulers/youtube-dl-update-scheduler.ts index 24cd3f87b..da47378e8 100644 --- a/server/lib/schedulers/youtube-dl-update-scheduler.ts +++ b/server/lib/schedulers/youtube-dl-update-scheduler.ts | |||
@@ -5,7 +5,7 @@ import { AbstractScheduler } from './abstract-scheduler' | |||
5 | import { SCHEDULER_INTERVALS_MS } from '../../initializers' | 5 | import { SCHEDULER_INTERVALS_MS } from '../../initializers' |
6 | import { logger } from '../../helpers/logger' | 6 | import { logger } from '../../helpers/logger' |
7 | import * as request from 'request' | 7 | import * as request from 'request' |
8 | import { createWriteStream, writeFile } from 'fs' | 8 | import { createWriteStream, writeFile } from 'fs-extra' |
9 | import { join } from 'path' | 9 | import { join } from 'path' |
10 | import { mkdirpPromise, root } from '../../helpers/core-utils' | 10 | import { mkdirpPromise, root } from '../../helpers/core-utils' |
11 | 11 | ||
diff --git a/server/tests/utils/users/accounts.ts b/server/tests/utils/users/accounts.ts index 30b3c54f8..024a315c7 100644 --- a/server/tests/utils/users/accounts.ts +++ b/server/tests/utils/users/accounts.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | 1 | /* tslint:disable:no-unused-expression */ |
2 | 2 | ||
3 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { existsSync } from 'fs' | 4 | import { existsSync } from 'fs-extra' |
5 | import { join } from 'path' | 5 | import { join } from 'path' |
6 | import { Account } from '../../../../shared/models/actors' | 6 | import { Account } from '../../../../shared/models/actors' |
7 | import { readdirPromise } from '../../../helpers/core-utils' | 7 | import { readdirPromise } from '../../../helpers/core-utils' |
diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts index 674a92df9..973bbbe87 100644 --- a/server/tests/utils/videos/videos.ts +++ b/server/tests/utils/videos/videos.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | 1 | /* tslint:disable:no-unused-expression */ |
2 | 2 | ||
3 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { existsSync, readFile } from 'fs' | 4 | import { existsSync, readFile } from 'fs-extra' |
5 | import * as parseTorrent from 'parse-torrent' | 5 | import * as parseTorrent from 'parse-torrent' |
6 | import { extname, join } from 'path' | 6 | import { extname, join } from 'path' |
7 | import * as request from 'supertest' | 7 | import * as request from 'supertest' |
diff --git a/server/tools/upload.ts b/server/tools/upload.ts index 4d40c8c1a..b5630bb9c 100644 --- a/server/tools/upload.ts +++ b/server/tools/upload.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import * as program from 'commander' | 1 | import * as program from 'commander' |
2 | import { access, constants } from 'fs' | 2 | import { access, constants } from 'fs-extra' |
3 | import { isAbsolute } from 'path' | 3 | import { isAbsolute } from 'path' |
4 | import { promisify } from 'util' | 4 | import { promisify } from 'util' |
5 | import { getClient, login } from '../tests/utils' | 5 | import { getClient, login } from '../tests/utils' |