![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
marmot-client
Advanced tools
例子 example
$ npm i -g ts-node
$ ts-node example/upload.ts
支持的接口
$ npm version patch
$ npm publish
import * as fs from 'fs';
import * as path from 'path';
import { MarmotClient } from 'marmot-client';
const client = new MarmotClient({
accessKeyId: 'YOUR_ACCESS_KEY_ID',
accessKeySecret: 'YOUR_ACCESS_KEY_SECRET',
endpoint: 'http://kapi.marmot-cloud.com',
apiVersion: '1.0.0',
});
// 1.1 上传公共文件,默认随机路径
async function uploadACLPublic() {
const result = await client.upload({
file: path.join(__dirname, 'sample.txt'),
fileType: 'txt'
});
console.log('上传公共文件,默认随机路径', result);
}
名称 | 类型 | 必填 | 默认值 | 样例 | 描述 |
---|---|---|---|---|---|
fileType | string | 是 | txt | 文件后缀名,需要和实际上传的文件类型一致 | |
file | string|Buffer|fs.ReadStream | 是 | path.join(__dirname, 'sample.txt') | 需要上传的文件 | |
storagePath | string | 否 | my-sample.txt | 可以自定义上传路径,默认上传到 uuid 随机路径 | |
contentDisposition | string | 否 | 默认是文件名 | attachment; filename=${encodeURIComponent('中文.xls')} | 指定 Content-Disposition,例如 Content-Disposition: attachment; filename="filename.jpg" 点击链接下载文件而非打开文件 |
env | string | 否 | 不传默认是ak申请时默认的bucket | DEV | DEV DEV、TEST、PRE、PROD,申请AK时如果自定义存储服务时可以指定存储Bucket的环境标识,传入该字段可以对该租户下的bucket进行按env筛选出要上传的目标bucket |
acl | string | 否 | public-read | private | private、public-read 标识返回的objectUrl是否是私有 |
... | 否 | 阿里云或者aws扩展参数,会原封不动的传给阿里云或者aws |
名称 | 类型 | 样例 | 描述 |
---|---|---|---|
objectUrl | string | http://cdn.marmot-cloud.com/storage/test-file-DEVELOPMENT/2022/07/08/4d33492e-7746-4d73-a747-f5fd27f28348.txt | 上传后的文件地址 |
一步上传的方式仅提供于纯服务端上传,如果你的应用有前端页面,我们强烈推荐你使用上述的两步接入的方法,需要 marmot-client 版本在 1.4.0 及以上才能使用。
FAQs
Marmot client.
The npm package marmot-client receives a total of 4 weekly downloads. As such, marmot-client popularity was classified as not popular.
We found that marmot-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.