文档可在此处获得,但令人震惊的是,没有 api 可以获取与du
linux 中的命令相同的目录大小。
https://www.backblaze.com/b2/docs
这有文件的 api,但没有目录大小的 api - https://www.backblaze.com/b2/docs/files.html
await b2.authorize();
await b2.listFileNames(bucketid);
await b2.getFileInfo(fileId) // gets the file info but directory has null in id field
Run Code Online (Sandbox Code Playgroud)
我们从上面得到这个结果 -
{ accountId: '11111111',
action: 'folder',
bucketId: '44444444444',
contentLength: 0,
contentSha1: null,
contentType: null,
fileId: null,
fileInfo: {},
fileName: 'test/testinside/',
uploadTimestamp: 0 }
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 mongodb 查询 mongodb simple findOne。Cloudflare 工作人员提供 10 毫秒的 CPU 时间,但在预览/发布期间抛出错误
我试过安装这些 npm 模块
npm i mongodb, mongodb-core, dgram, fs
Run Code Online (Sandbox Code Playgroud)
var MongoClient = require('mongodb').MongoClient;
try{
var db = await MongoClient.connect('mongodb+srv://mongoURL',{ useNewUrlParser: true,useUnifiedTopology: true });
var dbo = db.db("test");
var result = await dbo.collection("testcollection").findOne()
const init = {
status: 200,
headers: { "Access-Control-Allow-Origin": "*", 'content-type': 'application/json' },
}
return new Response(JSON.stringify(result), init)
} catch(e) { console.log(e); return new Response(JSON.stringify(result), init) }
Run Code Online (Sandbox Code Playgroud)
抛出的错误在这里 - https://pastebin.com/xMKKjdZF