@jx3box/sdk
v1.0.3
Published
JX3BOX公共资源sdk
Downloads
1
Readme
jx3box SDK
安装
npm install @jx3box/sdk --save
快速开始
资源访问
import {SignSDK} from "@jx3box/sdk"
import * as http from "http"
function TestSDK() {
const appid = "A"
const secretKey = "B"
const targetURL = "http://resource.jx3box.com/xxxx?a=1&xxx=2&xxx=23123"
const sdk = new SignSDK(appid, secretKey)
const raw = sdk.getSignedURL(targetURL)
http.get(raw, (res: http.IncomingMessage) => {
res.setEncoding('utf8');
let rawData = '';
res.on('data', (chunk) => { rawData += chunk; });
res.on('end', () => {
try {
console.log(rawData);
} catch (e: any) {
console.error(e.message);
}
});
}).on('error', (e) => {
console.error(`Got error: ${e.message}`);
});
}
TestSDK()