update
This commit is contained in:
21
test/upload.ts
Normal file
21
test/upload.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { nocoApi } from './common';
|
||||
import util from 'node:util';
|
||||
const filePath = path.resolve(process.cwd(), 'public/mole.png');
|
||||
const absolutePath = path.resolve(process.cwd(), filePath);
|
||||
const fileBuffer = fs.readFileSync(absolutePath);
|
||||
const blob = new Blob([fileBuffer], { type: 'image/png' });
|
||||
|
||||
const res = await nocoApi.upload.createUpload({
|
||||
file: blob,
|
||||
title: 'mole3.png',
|
||||
})
|
||||
console.log('上传结果:');
|
||||
console.log(util.inspect(res, { depth: null }));
|
||||
// const update = await nocoApi.record.update({
|
||||
// Id: 4,
|
||||
// Picture: res.list
|
||||
// })
|
||||
|
||||
// console.log(update)
|
||||
Reference in New Issue
Block a user