0.0.14 • Published 7 months ago

dmp-file v0.0.14

Weekly downloads
-
License
ISC
Repository
-
Last release
7 months ago

dmp-file

Installation

npm install dmp-file --save

Usage

import { uploadFile } from 'dmp-file'

/*
 * 上传
 *uploadFile(url, groupCode, file, fileBucket, func)
 * @param url 必须 string 文件服务地址 例如‘http://dev.ysbdtp.com/dmp-file’
 * @param groupCode 必须 string 集团编码 例如‘YL’
 * @param file 必须 文件 例如‘input.files[0]’
 * @param fileBucket 必须 string 存储空间名称 允许字符:小写字母、连字符(-)、数字 长度为3至63 开头和结尾必须是字母或数字
 * @param func 非必须 function 回调函数 默认console.log步骤
 * { 回调函数返回值
 *  msg:'',
 *  chunkCount:1,
 *  partNumber:0,
 *  finalData:{} composeFile或者秒传(uploadCode200时) 成功后返回
 * }
 */

uploadFile('http://dev.ysbdtp.com/dmp-file', 'YL', event.target.files[0], 'test-bucket', func)
import { downloadFile } from 'dmp-file'

/*
 * 下载
 * downloadFile(url, groupCode, id)
 * @param url 必须 string 文件服务地址 例如‘http://dev.ysbdtp.com/dmp-file’
 * @param groupCode 必须 string 集团编码 例如‘YL’
 * @param id 必须 string 文件id
  *返回值 示例
    {
      "result": "success",
      "data": {
        "id": "1562999723570827265",
        "valid": 1,
        "creationTime": 1661483147000,
        "creator": "0",
        "modifiedTime": 1661483147000,
        "modifier": "0",
        "groupCode": "YL",
        "fileName": "2.jpeg",
        "fileType": "0",
        "fileBucket": "test-bucket",
        "filePath": "20220826/2.jpeg",
        "fileSize": 205489,
        "fileMd5": "3ef48c1a8a95df308eff872082280815",
        "uploadStatus": 0,
        "businessId": null,
        "expireDate": null,
        "fileDownloadUrl": "http://dev.ysbdtp.com:9000/test-bucket/20220826/2.jpeg?response-content-disposition=filename%3D2.jpeg&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=persagy%2F20220826%2FGM%2B8%2Fs3%2Faws4_request&X-Amz-Date=20220826T030547Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=d6bd495e65465afd4fd9737e7c8deb0e0c25d1847aa78696c2993f0055f8969a",
        "persisFileDownloadUrl": "http://dev.ysbdtp.com:9000/test-bucket/20220826/2.jpeg"
      }
    }
  *各前端应用有各自的下载处理方式,故此处只返回文件的存储信息,开发者可使用fileDownloadUrl路径,进行下载
 */

downloadFile('http://dev.ysbdtp.com/dmp-file', 'YL', id)

License

ISC

0.0.11

8 months ago

0.0.12

8 months ago

0.0.13

8 months ago

0.0.14

7 months ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.5

3 years ago

0.0.6

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago