4.5.201903061424 • Published 7 years ago

@dfeidao/file v4.5.201903061424

Weekly downloads
1
License
-
Repository
-
Last release
7 years ago

文件服务



Configuration

feidao.json

{
	"appid": "web-client",
	"mqtt": {
		"uri": "mqtt://127.0.0.1:9001",
		"topic": "/request/clientmsg",
		"timeout": 10000
	},
	"port": 8888,
	"acao": "*",
	"maxFileSize": 52428800
}

说明:

  • mqtt 参数,用于获取文件存储信息 uri: mqtt地址 topic: 访问soa的topic * timeout: 访问soa超时时间设置

  • 服务 port: 文件服务端口号 跨域访问策略 acao: 其内容将被写入响应头Access-Control-Allow-Origin项中. ``表示允许所有跨域访问;该项为空则不允许所有跨域访问;也可以为域列表。详情参阅CORS_Enabled 文件大小限制 maxFileSize : 以字节为单位。如50m文件 52428800 = 5010241024

log4js.json

日志配置,具体请参考官方说明:log4js

安装并启动

npm i @dfeidao/file

example

文件上传 只上传原图:http://127.0.0.1:8888/upload?productid=feidao 根据策略处理图片:http://127.0.0.1:8888/upload?modelid=wpf&systemid=11&spaceid=feidao&productid=feidao 文件下载 浏览器打开:http://127.0.0.1:8888/getfile?productid=feidao&id=3be6b6c8ba864ed3851a91bd0b5ae12e 文件流下载:http://127.0.0.1:8888/getfile?productid=feidao&id=3be6b6c8ba864ed3851a91bd0b5ae12e&download=true 删除文件 http://127.0.0.1:8888/delfile?productid=feidao&delfile_name=3be6b6c8ba864ed3851a91bd0b5ae12e 替换文件 http://127.0.0.1:8888/reupload?productid=feidao&delfile_name=3be6b6c8ba864ed3851a91bd0b5ae12e