miniprogram-file
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

miniprogram-file

小程序的File polyfill。


支持的小程序

  • 微信小程序
  • 支付宝小程序
  • 字节小程序

其他小程序没有进行测试,可以自行测试


Example

import File from 'miniprogram-file'

// 设置为全局对象
// globalThis.File = File

const file = new File(["foo"], "foo.txt", {
  type: "text/plain",
});

TIP:
支付宝小程序IDE环境下globalThis为undefined,解决方法
字节小程序所有环境的globalThis都为undefined,暂时无法设置全局变量。


API

参考: https://developer.mozilla.org/zh-CN/docs/Web/API/File

Package Sidebar

Install

npm i miniprogram-file

Weekly Downloads

41

Version

2.0.0

License

MIT

Unpacked Size

5.22 kB

Total Files

7

Last publish

Collaborators

  • zhaoyirong