feat:提交
This commit is contained in:
22
tests/dev1/dataHandle/common/file.ts
Normal file
22
tests/dev1/dataHandle/common/file.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
export async function readText(file: Blob, encoding?: string): Promise<string>
|
||||
{
|
||||
return new Promise((resolve) =>
|
||||
{
|
||||
let fileReader = new FileReader()
|
||||
fileReader.onload = function (e)
|
||||
{
|
||||
resolve(<string> this.result)
|
||||
}
|
||||
fileReader.readAsText(file, encoding)
|
||||
})
|
||||
}
|
||||
|
||||
export function getFileExt(name: string)
|
||||
{
|
||||
let index = name.lastIndexOf('.')
|
||||
if (index != -1)
|
||||
{
|
||||
return name.substring(index + 1, name.length)
|
||||
}
|
||||
return null
|
||||
}
|
Reference in New Issue
Block a user