ppagent / AsyncFile
Class: AsyncFile
Defined in: src/util/async.file.ts:39
Implements
Constructors
Constructor
new AsyncFile(
loader,format):AsyncFile
Defined in: src/util/async.file.ts:45
init async file.use loader to load init data.
Parameters
loader
format
"text" | "binary"
Returns
AsyncFile
Accessors
name
Get Signature
get name():
string
Defined in: src/util/async.file.ts:61
Returns
string
Implementation of
Methods
asBase64()
asBase64():
Promise<string>
Defined in: src/util/async.file.ts:206
Returns
Promise<string>
Implementation of
asBuffer()
asBuffer():
Promise<Buffer<ArrayBufferLike>>
Defined in: src/util/async.file.ts:171
Returns
Promise<Buffer<ArrayBufferLike>>
Implementation of
asLocalPath()
asLocalPath():
Promise<string>
Defined in: src/util/async.file.ts:255
Returns
Promise<string>
Implementation of
asPath()
asPath():
Promise<string>
Defined in: src/util/async.file.ts:197
Returns
Promise<string>
Implementation of
asReadStream()
asReadStream():
Promise<ReadStream>
Defined in: src/util/async.file.ts:268
Returns
Promise<ReadStream>
Implementation of
asText()
asText():
Promise<string>
Defined in: src/util/async.file.ts:216
Returns
Promise<string>
Implementation of
asUrl()
asUrl():
Promise<string>
Defined in: src/util/async.file.ts:234
确保该文件可以通过url访问,该文件将被复制到public/temp/目录下,同时根据config中httpUrl生成访问路径
Returns
Promise<string>
Implementation of
getFormat()
getFormat():
"text"|"binary"
Defined in: src/util/async.file.ts:167
Returns
"text" | "binary"
Implementation of
info()
info():
Promise<Stats>
Defined in: src/util/async.file.ts:274
Returns
Promise<Stats>
Implementation of
isAsyncFile()
isAsyncFile():
boolean
Defined in: src/util/async.file.ts:290
Returns
boolean
Implementation of
saveAs()
saveAs(
dir,bucket,name?,onCompleted?):string
Defined in: src/util/async.file.ts:152
Parameters
dir
string
bucket
string
name?
string
onCompleted?
() => void
Returns
string
toString()
toString():
string
Defined in: src/util/async.file.ts:294
Returns a string representation of an object.
Returns
string
fromBuffer()
staticfromBuffer(buffer,name?,format?,textEncoding?):AsyncFile
Defined in: src/util/async.file.ts:328
从buffer创建
Parameters
buffer
Buffer
name?
string
format?
"text" | "binary"
textEncoding?
BufferEncoding
Returns
AsyncFile
fromPath()
staticfromPath(userPath,format,fileName?,textEncoding?):AsyncFile
Defined in: src/util/async.file.ts:304
从本地路径或者网络url创建
Parameters
userPath
string
format
"text" | "binary"
fileName?
string
textEncoding?
BufferEncoding
Returns
AsyncFile