aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2018-08-27 13:28:49 +0200
committerChocobozzz <me@florianbigard.com>2018-08-27 16:03:57 +0200
commitc9d5c64f98c1f1fe7950de60c58edeaf3ace070d (patch)
tree26d828e560054cf8a64628823d3dd86172d44f52 /server
parent0ee027347ae09ea397e9b85702707e9179537ebd (diff)
downloadPeerTube-c9d5c64f98c1f1fe7950de60c58edeaf3ace070d.tar.gz
PeerTube-c9d5c64f98c1f1fe7950de60c58edeaf3ace070d.tar.zst
PeerTube-c9d5c64f98c1f1fe7950de60c58edeaf3ace070d.zip
replace fs by fs-extra to prevent EMFILE error
Diffstat (limited to 'server')
-rw-r--r--server/controllers/static.ts2
-rw-r--r--server/helpers/captions-utils.ts2
-rw-r--r--server/helpers/core-utils.ts3
-rw-r--r--server/helpers/logger.ts4
-rw-r--r--server/helpers/requests.ts2
-rw-r--r--server/helpers/webtorrent.ts2
-rw-r--r--server/initializers/migrations/0065-video-file-size.ts2
-rw-r--r--server/lib/cache/abstract-video-static-file-cache.ts2
-rw-r--r--server/lib/emailer.ts2
-rw-r--r--server/lib/schedulers/youtube-dl-update-scheduler.ts2
-rw-r--r--server/tests/utils/users/accounts.ts2
-rw-r--r--server/tests/utils/videos/videos.ts2
-rw-r--r--server/tools/upload.ts2
13 files changed, 14 insertions, 15 deletions
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 @@
1import * as cors from 'cors' 1import * as cors from 'cors'
2import { createReadStream } from 'fs' 2import { createReadStream } from 'fs-extra'
3import * as express from 'express' 3import * as express from 'express'
4import { CONFIG, STATIC_DOWNLOAD_PATHS, STATIC_MAX_AGE, STATIC_PATHS, ROUTE_CACHE_LIFETIME } from '../initializers' 4import { CONFIG, STATIC_DOWNLOAD_PATHS, STATIC_MAX_AGE, STATIC_PATHS, ROUTE_CACHE_LIFETIME } from '../initializers'
5import { VideosPreviewCache } from '../lib/cache' 5import { 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'
3import { CONFIG } from '../initializers' 3import { CONFIG } from '../initializers'
4import { VideoCaptionModel } from '../models/video/video-caption' 4import { VideoCaptionModel } from '../models/video/video-caption'
5import * as srt2vtt from 'srt-to-vtt' 5import * as srt2vtt from 'srt-to-vtt'
6import { createReadStream, createWriteStream } from 'fs' 6import { createReadStream, createWriteStream } from 'fs-extra'
7 7
8async function moveAndProcessCaptionFile (physicalFile: { filename: string, path: string }, videoCaption: VideoCaptionModel) { 8async 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 @@
6import * as bcrypt from 'bcrypt' 6import * as bcrypt from 'bcrypt'
7import * as createTorrent from 'create-torrent' 7import * as createTorrent from 'create-torrent'
8import { createHash, pseudoRandomBytes } from 'crypto' 8import { createHash, pseudoRandomBytes } from 'crypto'
9import { copyFile, readdir, readFile, rename, stat, Stats, unlink, writeFile } from 'fs' 9import { copyFile, readdir, readFile, rename, stat, Stats, unlink, writeFile, mkdirp } from 'fs-extra'
10import * as mkdirp from 'mkdirp'
11import { isAbsolute, join } from 'path' 10import { isAbsolute, join } from 'path'
12import * as pem from 'pem' 11import * as pem from 'pem'
13import * as rimraf from 'rimraf' 12import * 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/
2import * as mkdirp from 'mkdirp' 2import { mkdirpSync } from 'fs-extra'
3import * as path from 'path' 3import * as path from 'path'
4import * as winston from 'winston' 4import * as winston from 'winston'
5import { CONFIG } from '../initializers' 5import { CONFIG } from '../initializers'
@@ -7,7 +7,7 @@ import { CONFIG } from '../initializers'
7const label = CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT 7const 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
10mkdirp.sync(CONFIG.STORAGE.LOG_DIR) 10mkdirpSync(CONFIG.STORAGE.LOG_DIR)
11 11
12function loggerReplacer (key: string, value: any) { 12function 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 @@
1import * as Bluebird from 'bluebird' 1import * as Bluebird from 'bluebird'
2import { createWriteStream } from 'fs' 2import { createWriteStream } from 'fs-extra'
3import * as request from 'request' 3import * as request from 'request'
4import { ACTIVITY_PUB } from '../initializers' 4import { 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 @@
1import { logger } from './logger' 1import { logger } from './logger'
2import { generateVideoTmpPath } from './utils' 2import { generateVideoTmpPath } from './utils'
3import * as WebTorrent from 'webtorrent' 3import * as WebTorrent from 'webtorrent'
4import { createWriteStream } from 'fs' 4import { createWriteStream } from 'fs-extra'
5import { CONFIG } from '../initializers' 5import { CONFIG } from '../initializers'
6import { join } from 'path' 6import { join } from 'path'
7import { unlinkPromise } from './core-utils' 7import { 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 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird' 2import * as Promise from 'bluebird'
3import { stat } from 'fs' 3import { stat } from 'fs-extra'
4import { VideoModel } from '../../models/video/video' 4import { VideoModel } from '../../models/video/video'
5 5
6function up (utils: { 6function 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 @@
1import * as AsyncLRU from 'async-lru' 1import * as AsyncLRU from 'async-lru'
2import { createWriteStream } from 'fs' 2import { createWriteStream } from 'fs-extra'
3import { unlinkPromise } from '../../helpers/core-utils' 3import { unlinkPromise } from '../../helpers/core-utils'
4import { logger } from '../../helpers/logger' 4import { logger } from '../../helpers/logger'
5import { VideoModel } from '../../models/video/video' 5import { 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'
7import { VideoModel } from '../models/video/video' 7import { VideoModel } from '../models/video/video'
8import { JobQueue } from './job-queue' 8import { JobQueue } from './job-queue'
9import { EmailPayload } from './job-queue/handlers/email' 9import { EmailPayload } from './job-queue/handlers/email'
10import { readFileSync } from 'fs' 10import { readFileSync } from 'fs-extra'
11 11
12class Emailer { 12class 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'
5import { SCHEDULER_INTERVALS_MS } from '../../initializers' 5import { SCHEDULER_INTERVALS_MS } from '../../initializers'
6import { logger } from '../../helpers/logger' 6import { logger } from '../../helpers/logger'
7import * as request from 'request' 7import * as request from 'request'
8import { createWriteStream, writeFile } from 'fs' 8import { createWriteStream, writeFile } from 'fs-extra'
9import { join } from 'path' 9import { join } from 'path'
10import { mkdirpPromise, root } from '../../helpers/core-utils' 10import { 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
3import { expect } from 'chai' 3import { expect } from 'chai'
4import { existsSync } from 'fs' 4import { existsSync } from 'fs-extra'
5import { join } from 'path' 5import { join } from 'path'
6import { Account } from '../../../../shared/models/actors' 6import { Account } from '../../../../shared/models/actors'
7import { readdirPromise } from '../../../helpers/core-utils' 7import { 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
3import { expect } from 'chai' 3import { expect } from 'chai'
4import { existsSync, readFile } from 'fs' 4import { existsSync, readFile } from 'fs-extra'
5import * as parseTorrent from 'parse-torrent' 5import * as parseTorrent from 'parse-torrent'
6import { extname, join } from 'path' 6import { extname, join } from 'path'
7import * as request from 'supertest' 7import * 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 @@
1import * as program from 'commander' 1import * as program from 'commander'
2import { access, constants } from 'fs' 2import { access, constants } from 'fs-extra'
3import { isAbsolute } from 'path' 3import { isAbsolute } from 'path'
4import { promisify } from 'util' 4import { promisify } from 'util'
5import { getClient, login } from '../tests/utils' 5import { getClient, login } from '../tests/utils'