pouet
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
import { objectMap, objectOmit } from '@dzeio/object-util'
|
||||
import URLManager from '@dzeio/url-manager'
|
||||
import type { APIRoute } from 'astro'
|
||||
import { exec as execSync } from 'child_process'
|
||||
import fs from 'fs/promises'
|
||||
import { evaluate } from 'mathjs'
|
||||
import { exec as execSync } from 'node:child_process'
|
||||
import fs from 'node:fs/promises'
|
||||
import os from 'node:os'
|
||||
import path from 'node:path/posix'
|
||||
import { promisify } from 'node:util'
|
||||
@ -24,7 +24,7 @@ export const post: APIRoute = async ({ request }) => {
|
||||
const file = (Math.random() * 1000000).toFixed(0)
|
||||
console.log('started processing new request', file)
|
||||
await fs.mkdir(`${tmpDir}/files`, { recursive: true })
|
||||
|
||||
|
||||
const overrides = objectOmit(query, 'algo', 'config')
|
||||
const configName = query?.config ?? 'config'
|
||||
let config = `${import.meta.env.CONFIGS_PATH}/` + configName + '.ini'
|
||||
@ -39,7 +39,7 @@ export const post: APIRoute = async ({ request }) => {
|
||||
}
|
||||
const stlPath = `${tmpDir}/files/${file}.stl`
|
||||
const gcodePath = `${tmpDir}/files/${file}.gcode`
|
||||
|
||||
|
||||
// write file
|
||||
await fs.writeFile(stlPath, new Uint8Array(Buffer.from(await request.arrayBuffer())), {
|
||||
encoding: null
|
||||
@ -143,4 +143,4 @@ export const post: APIRoute = async ({ request }) => {
|
||||
gcode
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user