Path: blob/main/third_party/closure-compiler/node-externs/fs.js
6172 views
/*1* Copyright 2012 The Closure Compiler Authors.2*3* Licensed under the Apache License, Version 2.0 (the "License");4* you may not use this file except in compliance with the License.5* You may obtain a copy of the License at6*7* http://www.apache.org/licenses/LICENSE-2.08*9* Unless required by applicable law or agreed to in writing, software10* distributed under the License is distributed on an "AS IS" BASIS,11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12* See the License for the specific language governing permissions and13* limitations under the License.14*/1516/**17* @fileoverview Definitions for node's fs module. Depends on the stream and events module.18* @see http://nodejs.org/api/fs.html19* @see https://github.com/joyent/node/blob/master/lib/fs.js20* @externs21* @author Daniel Wirtz <[email protected]>22*/2324/**25BEGIN_NODE_INCLUDE26var fs = require('fs');27END_NODE_INCLUDE28*/2930var fs = {};3132/**33* @param {string} oldPath34* @param {string} newPath35* @param {function(...)=} callback36*/37fs.rename = function(oldPath, newPath, callback) {};3839/**40* @param {string} oldPath41* @param {string} newPath42*/43fs.renameSync = function(oldPath, newPath) {};4445/**46* @param {*} fd47* @param {number} len48* @param {function(...)=} callback49*/50fs.truncate = function(fd, len, callback) {};5152/**53* @param {*} fd54* @param {number} len55*/56fs.truncateSync = function(fd, len) {};5758/**59* @param {*} fd60* @param {number} len61*/62fs.ftruncateSync = function(fd, len) {};6364/**65* @param {string} path66* @param {number} uid67* @param {number} gid68* @param {function(...)=} callback69*/70fs.chown = function(path, uid, gid, callback) {};7172/**73* @param {string} path74* @param {number} uid75* @param {number} gid76*/77fs.chownSync = function(path, uid, gid) {};7879/**80* @param {*} fd81* @param {number} uid82* @param {number} gid83* @param {function(...)=} callback84*/85fs.fchown = function(fd, uid, gid, callback) {};8687/**88* @param {*} fd89* @param {number} uid90* @param {number} gid91*/92fs.fchownSync = function(fd, uid, gid) {};9394/**95* @param {string} path96* @param {number} uid97* @param {number} gid98* @param {function(...)=} callback99*/100fs.lchown = function(path, uid, gid, callback) {};101102/**103* @param {string} path104* @param {number} uid105* @param {number} gid106*/107fs.lchownSync = function(path, uid, gid) {};108109/**110* @param {string} path111* @param {number} mode112* @param {function(...)=} callback113*/114fs.chmod = function(path, mode, callback) {};115116/**117* @param {string} path118* @param {number} mode119*/120fs.chmodSync = function(path, mode) {};121122/**123* @param {*} fd124* @param {number} mode125* @param {function(...)=} callback126*/127fs.fchmod = function(fd, mode, callback) {};128129/**130* @param {*} fd131* @param {number} mode132*/133fs.fchmodSync = function(fd, mode) {};134135/**136* @param {string} path137* @param {number} mode138* @param {function(...)=} callback139*/140fs.lchmod = function(path, mode, callback) {};141142/**143* @param {string} path144* @param {number} mode145*/146fs.lchmodSync = function(path, mode) {};147148/**149* @param {string} path150* @param {function(string, fs.Stats)=} callback151*/152fs.stat = function(path, callback) {};153154/**155* @param {string} path156* @return {fs.Stats}157* @nosideeffects158*/159fs.statSync = function(path) {}160161/**162* @param {*} fd163* @param {function(string, fs.Stats)=} callback164*/165fs.fstat = function(fd, callback) {};166167/**168* @param {*} fd169* @return {fs.Stats}170* @nosideeffects171*/172fs.fstatSync = function(fd) {}173174/**175* @param {string} path176* @param {function(string, fs.Stats)=} callback177*/178fs.lstat = function(path, callback) {};179180/**181* @param {string} path182* @return {fs.Stats}183* @nosideeffects184*/185fs.lstatSync = function(path) {}186187/**188* @param {string} srcpath189* @param {string} dstpath190* @param {function(...)=} callback191*/192fs.link = function(srcpath, dstpath, callback) {};193194/**195* @param {string} srcpath196* @param {string} dstpath197*/198fs.linkSync = function(srcpath, dstpath) {};199200/**201* @param {string} srcpath202* @param {string} dstpath203* @param {string=} type204* @param {function(...)=} callback205*/206fs.symlink = function(srcpath, dstpath, type, callback) {};207208/**209* @param {string} srcpath210* @param {string} dstpath211* @param {string=} type212*/213fs.symlinkSync = function(srcpath, dstpath, type) {};214215/**216* @param {string} path217* @param {function(string, string)=} callback218*/219fs.readlink = function(path, callback) {};220221/**222* @param {string} path223* @return {string}224* @nosideeffects225*/226fs.readlinkSync = function(path) {};227228/**229* @param {string} path230* @param {Object.<string,string>|function(string, string)=} cache231* @param {function(string, string)=} callback232*/233fs.realpath = function(path, cache, callback) {};234235/**236* @param {string} path237* @param {Object.<string,string>=} cache238* @return {string}239* @nosideeffects240*/241fs.realpathSync = function(path, cache) {};242243/**244* @param {string} path245* @param {function(...)=} callback246*/247fs.unlink = function(path, callback) {};248249/**250* @param {string} path251*/252fs.unlinkSync = function(path) {};253254/**255* @param {string} path256* @param {function(...)=} callback257*/258fs.rmdir = function(path, callback) {};259260/**261* @param {string} path262*/263fs.rmdirSync = function(path) {};264265/**266* @param {string} path267* @param {number=} mode268* @param {function(...)=} callback269*/270fs.mkdir = function(path, mode, callback) {};271272/**273* @param {string} path274* @param {number=} mode275*/276fs.mkdirSync = function(path, mode) {};277278/**279* @param {string} path280* @param {function(string,Array.<string>)=} callback281*/282fs.readdir = function(path, callback) {};283284/**285* @param {string} path286* @return {Array.<string>}287* @nosideeffects288*/289fs.readdirSync = function(path) {};290291/**292* @param {*} fd293* @param {function(...)=} callback294*/295fs.close = function(fd, callback) {};296297/**298* @param {*} fd299*/300fs.closeSync = function(fd) {};301302/**303* @param {string} path304* @param {string} flags305* @param {number=} mode306* @param {function(string, *)=} callback307*/308fs.open = function(path, flags, mode, callback) {};309310/**311* @param {string} path312* @param {string} flags313* @param {number=} mode314* @return {*}315* @nosideeffects316*/317fs.openSync = function(path, flags, mode) {};318319/**320* @param {string} path321* @param {number|Date} atime322* @param {number|Date} mtime323* @param {function(...)=} callback324*/325fs.utimes = function(path, atime, mtime, callback) {};326327/**328* @param {string} path329* @param {number|Date} atime330* @param {number|Date} mtime331* @nosideeffects332*/333fs.utimesSync = function(path, atime, mtime) {};334335/**336* @param {*} fd337* @param {number|Date} atime338* @param {number|Date} mtime339* @param {function(...)=} callback340*/341fs.futimes = function(fd, atime, mtime, callback) {};342343/**344* @param {*} fd345* @param {number|Date} atime346* @param {number|Date} mtime347* @nosideeffects348*/349fs.futimesSync = function(fd, atime, mtime) {};350351/**352* @param {*} fd353* @param {function(...)=} callback354*/355fs.fsync = function(fd, callback) {};356357/**358* @param {*} fd359*/360fs.fsyncSync = function(fd) {};361362/**363* @param {*} fd364* @param {*} buffer365* @param {number} offset366* @param {number} length367* @param {number} position368* @param {function(string, number, *)=} callback369*/370fs.write = function(fd, buffer, offset, length, position, callback) {};371372/**373* @param {*} fd374* @param {*} buffer375* @param {number=} offset376* @param {number=} length377* @param {number=} position378* @return {number}379*/380fs.writeSync = function(fd, buffer, offset, length, position) {};381382/**383* @param {*} fd384* @param {*} buffer385* @param {number} offset386* @param {number} length387* @param {number} position388* @param {function(string, number, *)=} callback389*/390fs.read = function(fd, buffer, offset, length, position, callback) {};391392/**393* @param {*} fd394* @param {*} buffer395* @param {number} offset396* @param {number} length397* @param {number=} position398* @return {number}399* @nosideeffects400*/401fs.readSync = function(fd, buffer, offset, length, position) {};402403/**404* @param {string} filename405* @param {string|{encoding:(string|undefined),flag:(string|undefined)}|function(string, (string|nodeBuffer.Buffer))=} encodingOrOptions406* @param {function(string, (string|nodeBuffer.Buffer))=} callback407*/408fs.readFile = function(filename, encodingOrOptions, callback) {};409410/**411* @param {string} filename412* @param {string|{encoding:(string|undefined),flag:(string|undefined)}=} encodingOrOptions413* @return {string|nodeBuffer.Buffer}414* @nosideeffects415*/416fs.readFileSync = function(filename, encodingOrOptions) {};417418/**419* @param {string} filename420* @param {*} data421* @param {string|{encoding:(string|undefined),mode:(number|undefined),flag:(string|undefined)}|function(string)=} encodingOrOptions422* @param {function(string)=} callback423*/424fs.writeFile = function(filename, data, encodingOrOptions, callback) {};425426/**427* @param {string} filename428* @param {*} data429* @param {string|{encoding:(string|undefined),mode:(number|undefined),flag:(string|undefined)}|function(string)=} encodingOrOptions430*/431fs.writeFileSync = function(filename, data, encodingOrOptions) {};432433/**434* @param {string} filename435* @param {*} data436* @param {string|function(string)=} encoding437* @param {function(string)=} callback438*/439fs.appendFile = function(filename, data, encoding, callback) {};440441/**442* @param {string} filename443* @param {*} data444* @param {string|function(string)=} encoding445*/446fs.appendFileSync = function(filename, data, encoding) {};447448/**449* @param {string} filename450* @param {{persistent: boolean, interval: number}|function(*,*)=} options451* @param {function(*,*)=} listener452*/453fs.watchFile = function(filename, options, listener) {};454455/**456* @param {string} filename457* @param {function(string, string)=} listener458*/459fs.unwatchFile = function(filename, listener) {};460461/**462*463* @param {string} filename464* @param {{persistent: boolean}|function(string, string)=} options465* @param {function(string, string)=} listener466* @return {fs.FSWatcher}467*/468fs.watch = function(filename, options, listener) {};469470/**471* @param {string} path472* @param {function(boolean)} callback473*/474fs.exists = function(path, callback) {};475476/**477* @param {string} path478* @nosideeffects479*/480fs.existsSync = function(path) {};481482/**483* @constructor484*/485fs.Stats = function() {};486487/**488* @return {boolean}489* @nosideeffects490*/491fs.Stats.prototype.isFile = function() {};492493/**494* @return {boolean}495* @nosideeffects496*/497fs.Stats.prototype.isDirectory = function() {};498499/**500* @return {boolean}501* @nosideeffects502*/503fs.Stats.prototype.isBlockDevice = function() {};504505/**506* @return {boolean}507* @nosideeffects508*/509fs.Stats.prototype.isCharacterDevice = function() {};510511/**512* @return {boolean}513* @nosideeffects514*/515fs.Stats.prototype.isSymbolicLink = function() {};516517/**518* @return {boolean}519* @nosideeffects520*/521fs.Stats.prototype.isFIFO = function() {};522523/**524* @return {boolean}525* @nosideeffects526*/527fs.Stats.prototype.isSocket = function() {};528529/**530* @type {number}531*/532fs.Stats.prototype.dev = 0;533534/**535* @type {number}536*/537fs.Stats.prototype.ino = 0;538539/**540* @type {number}541*/542fs.Stats.prototype.mode = 0;543544/**545* @type {number}546*/547fs.Stats.prototype.nlink = 0;548549/**550* @type {number}551*/552fs.Stats.prototype.uid = 0;553554/**555* @type {number}556*/557fs.Stats.prototype.gid = 0;558559/**560* @type {number}561*/562fs.Stats.prototype.rdev = 0;563564/**565* @type {number}566*/567fs.Stats.prototype.size = 0;568569/**570* @type {number}571*/572fs.Stats.prototype.blkSize = 0;573574/**575* @type {number}576*/577fs.Stats.prototype.blocks = 0;578579/**580* @type {Date}581*/582fs.Stats.prototype.atime;583584/**585* @type {Date}586*/587fs.Stats.prototype.mtime;588589/**590* @type {Date}591*/592fs.Stats.prototype.ctime;593594/**595* @param {string} path596* @param {{flags: string, encoding: ?string, fd: *, mode: number, bufferSize: number}=} options597* @return {fs.ReadStream}598* @nosideeffects599*/600fs.createReadStream = function(path, options) {};601602/**603* @constructor604* @extends stream.ReadableStream605*/606fs.ReadStream = function() {};607608/**609* @param {string} path610* @param {{flags: string, encoding: ?string, mode: number}=} options611* @return {fs.WriteStream}612* @nosideeffects613*/614fs.createWriteStream = function(path, options) {};615616/**617* @constructor618* @extends stream.WritableStream619*/620fs.WriteStream = function() {};621622/**623* @constructor624* @extends events.EventEmitter625*/626fs.FSWatcher = function() {};627628/**629*/630fs.FSWatcher.prototype.close = function() {};631632633