update
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import { NocoApi } from './../src/main.ts';
|
||||
import { useConfig } from '@kevisual/use-config'
|
||||
export const config = useConfig()
|
||||
|
||||
import util from 'node:util';
|
||||
// # 签到表
|
||||
const table = 'mcby44q8zrayvn9'
|
||||
// const table = 'mcby44q8zrayvn9'
|
||||
// 本地
|
||||
const table = 'mi89er1m951pb3g'
|
||||
export const nocoApi = new NocoApi({
|
||||
baseURL: config.NOCODB_URL || 'http://localhost:8080',
|
||||
token: config.NOCODB_API_KEY || '',
|
||||
@@ -11,4 +13,5 @@ export const nocoApi = new NocoApi({
|
||||
});
|
||||
|
||||
|
||||
// console.log('nocoApi', await nocoApi.record.list())
|
||||
// const list = await nocoApi.record.list()
|
||||
// console.log(util.inspect(list, { depth: null, colors: true }))
|
||||
|
||||
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