Commit c9d5c64f authored by Rigel Kent's avatar Rigel Kent Committed by Chocobozzz

replace fs by fs-extra to prevent EMFILE error

parent 0ee02734
import { doRequest } from '../server/helpers/requests'
import { readFileSync } from 'fs'
import { readFileSync } from 'fs-extra'
run()
.then(() => process.exit(0))
......
import * as jsToXliff12 from 'xliff/jsToXliff12'
import { writeFile } from 'fs'
import { writeFile } from 'fs-extra'
import { join } from 'path'
import {
buildLanguages,
......
import * as xliff12ToJs from 'xliff/xliff12ToJs'
import { readFileSync, unlink, writeFile } from 'fs'
import { readFileSync, unlink, writeFile } from 'fs-extra'
import { join } from 'path'
import { buildFileLocale, I18N_LOCALES, isDefaultLocale } from '../../shared/models/i18n/i18n'
import { eachSeries } from 'async'
......
import * as program from 'commander'
import { createReadStream, readdirSync, statSync } from 'fs'
import { createReadStream, readdirSync, statSync } from 'fs-extra'
import { join } from 'path'
import { createInterface } from 'readline'
import * as winston from 'winston'
......
import * as cors from 'cors'
import { createReadStream } from 'fs'
import { createReadStream } from 'fs-extra'
import * as express from 'express'
import { CONFIG, STATIC_DOWNLOAD_PATHS, STATIC_MAX_AGE, STATIC_PATHS, ROUTE_CACHE_LIFETIME } from '../initializers'
import { VideosPreviewCache } from '../lib/cache'
......
......@@ -3,7 +3,7 @@ import { join } from 'path'
import { CONFIG } from '../initializers'
import { VideoCaptionModel } from '../models/video/video-caption'
import * as srt2vtt from 'srt-to-vtt'
import { createReadStream, createWriteStream } from 'fs'
import { createReadStream, createWriteStream } from 'fs-extra'
async function moveAndProcessCaptionFile (physicalFile: { filename: string, path: string }, videoCaption: VideoCaptionModel) {
const videoCaptionsDir = CONFIG.STORAGE.CAPTIONS_DIR
......
......@@ -6,8 +6,7 @@
import * as bcrypt from 'bcrypt'
import * as createTorrent from 'create-torrent'
import { createHash, pseudoRandomBytes } from 'crypto'
import { copyFile, readdir, readFile, rename, stat, Stats, unlink, writeFile } from 'fs'
import * as mkdirp from 'mkdirp'
import { copyFile, readdir, readFile, rename, stat, Stats, unlink, writeFile, mkdirp } from 'fs-extra'
import { isAbsolute, join } from 'path'
import * as pem from 'pem'
import * as rimraf from 'rimraf'
......
// Thanks http://tostring.it/2014/06/23/advanced-logging-with-nodejs/
import * as mkdirp from 'mkdirp'
import { mkdirpSync } from 'fs-extra'
import * as path from 'path'
import * as winston from 'winston'
import { CONFIG } from '../initializers'
......@@ -7,7 +7,7 @@ import { CONFIG } from '../initializers'
const label = CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT
// Create the directory if it does not exist
mkdirp.sync(CONFIG.STORAGE.LOG_DIR)
mkdirpSync(CONFIG.STORAGE.LOG_DIR)
function loggerReplacer (key: string, value: any) {
if (value instanceof Error) {
......
import * as Bluebird from 'bluebird'
import { createWriteStream } from 'fs'
import { createWriteStream } from 'fs-extra'
import * as request from 'request'
import { ACTIVITY_PUB } from '../initializers'
......
import { logger } from './logger'
import { generateVideoTmpPath } from './utils'
import * as WebTorrent from 'webtorrent'
import { createWriteStream } from 'fs'
import { createWriteStream } from 'fs-extra'
import { CONFIG } from '../initializers'
import { join } from 'path'
import { unlinkPromise } from './core-utils'
......
import * as Sequelize from 'sequelize'
import * as Promise from 'bluebird'
import { stat } from 'fs'
import { stat } from 'fs-extra'
import { VideoModel } from '../../models/video/video'
function up (utils: {
......
import * as AsyncLRU from 'async-lru'
import { createWriteStream } from 'fs'
import { createWriteStream } from 'fs-extra'
import { unlinkPromise } from '../../helpers/core-utils'
import { logger } from '../../helpers/logger'
import { VideoModel } from '../../models/video/video'
......
......@@ -7,7 +7,7 @@ import { UserModel } from '../models/account/user'
import { VideoModel } from '../models/video/video'
import { JobQueue } from './job-queue'
import { EmailPayload } from './job-queue/handlers/email'
import { readFileSync } from 'fs'
import { readFileSync } from 'fs-extra'
class Emailer {
......
......@@ -5,7 +5,7 @@ import { AbstractScheduler } from './abstract-scheduler'
import { SCHEDULER_INTERVALS_MS } from '../../initializers'
import { logger } from '../../helpers/logger'
import * as request from 'request'
import { createWriteStream, writeFile } from 'fs'
import { createWriteStream, writeFile } from 'fs-extra'
import { join } from 'path'
import { mkdirpPromise, root } from '../../helpers/core-utils'
......
/* tslint:disable:no-unused-expression */
import { expect } from 'chai'
import { existsSync } from 'fs'
import { existsSync } from 'fs-extra'
import { join } from 'path'
import { Account } from '../../../../shared/models/actors'
import { readdirPromise } from '../../../helpers/core-utils'
......
/* tslint:disable:no-unused-expression */
import { expect } from 'chai'
import { existsSync, readFile } from 'fs'
import { existsSync, readFile } from 'fs-extra'
import * as parseTorrent from 'parse-torrent'
import { extname, join } from 'path'
import * as request from 'supertest'
......
import * as program from 'commander'
import { access, constants } from 'fs'
import { access, constants } from 'fs-extra'
import { isAbsolute } from 'path'
import { promisify } from 'util'
import { getClient, login } from '../tests/utils'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment