Search found 99 matches

by bkromer
Thu Oct 06, 2022 11:39 am
Forum: Node.js scripting
Topic: error importing axios in typescript script folder
Replies: 6
Views: 5362

Re: error importing axios in typescript script folder

What version of axios are you using (check package.json)? ... "dependencies": { "axios": "^1.0.0" }... Thats the newest. I uninstalled it and forced the installation of axios@0.27.2 and it worked right away. I am going to try newer versions step by step I just saw in a...
by bkromer
Thu Oct 06, 2022 9:21 am
Forum: Node.js scripting
Topic: error importing axios in typescript script folder
Replies: 6
Views: 5362

Re: error importing axios in typescript script folder

Are these new scripts or old scripts? Check if you have a tsconfig.json file in the script folder. If not, create a new script folder and copy the tsconfig.json from there and see if it solves the problem. Its a completely new created script folder with typescript option checked. It has the tsconfi...
by bkromer
Wed Oct 05, 2022 5:52 pm
Forum: Node.js scripting
Topic: error importing axios in typescript script folder
Replies: 6
Views: 5362

error importing axios in typescript script folder

I have created a script folder with typescript support. When I try to import axios like import axios from 'axios'; Switch gives me this error: require() of ES Module C:\Users\Administrator\Documents\Skripte\App\node_modules\axios\index.js from C:\Program Files\Enfocus\Enfocus Switch\ScriptExecutor\N...
by bkromer
Tue May 03, 2022 3:20 pm
Forum: PDF Creation
Topic: Generate German CIUS xRechnung (Electronic Invoice) with XML + PDF
Replies: 0
Views: 10363

Generate German CIUS xRechnung (Electronic Invoice) with XML + PDF

Does anybody know how to generate PDF Invoice in the format of the german CIUS xRechnung (Electronic Invoice)?

Its a PDF with a XML attached to it... :roll:
https://www.xoev.de/xrechnung-16828#EN
https://github.com/itplr-kosit
by bkromer
Wed Feb 23, 2022 7:29 pm
Forum: Switch
Topic: File to Switch Web Service from Postman
Replies: 1
Views: 2052

Re: File to Switch Web Service from Postman

Share your code. You picked the hardest part of it all. :) What is the response from the webservice?
by bkromer
Wed Feb 23, 2022 6:49 pm
Forum: Node.js scripting
Topic: How to use flowElement.createJob to save a writeStream
Replies: 3
Views: 3651

Re: How to use flowElement.createJob to save a writeStream

I tried to use this code to download single files from dropbox via API. But there it doesn't work!? I get an empty PDF file. But when I instead save the file locally it works await response.data.pipe(fs.createWriteStream(path)); I guess I need to use some sort of temporary file to create a new job? ...
by bkromer
Tue Feb 22, 2022 1:04 pm
Forum: Node.js scripting
Topic: compress a file with folder structure to tgz
Replies: 2
Views: 2210

Re: compress a file with folder structure to tgz

Can archive create tgz? I thought about compressing it within the script. Something like: const fs = require("fs"); const tmp = require('tmp'); const compressing = require("compressing"); async function jobArrived(s, flowElement, job) { const entranceJob = await job.get( AccessLe...
by bkromer
Tue Feb 22, 2022 11:30 am
Forum: Node.js scripting
Topic: compress a file with folder structure to tgz
Replies: 2
Views: 2210

compress a file with folder structure to tgz

I need to compress the incoming file (.png) to .tgz and it needs to be in a specific directory like "/folder1/folder2/myfile.png". I found this npm module https://www.npmjs.com/package/compressing So the incoming file will be a single file in the format of .png. Maybe I can create a tmp fo...
by bkromer
Mon Jan 10, 2022 5:52 pm
Forum: Node.js scripting
Topic: fs.readFile from local path in node.js
Replies: 3
Views: 2905

Re: fs.readFile from local path in node.js

Thanks double slashes worked "C://Users//.... :lol: "
by bkromer
Mon Jan 10, 2022 4:45 pm
Forum: Node.js scripting
Topic: fs.readFile from local path in node.js
Replies: 3
Views: 2905

fs.readFile from local path in node.js

My Switch Server runs on Windows. I want to read a *.pdf locally to upload it later in a form data API Call. I want to define a path to "C:/Users/username/Documents/Scripts/pdfsforupload/mypdf.pdf". Is it correct to use this syntax? const file = fs.readFileSync(`//Users/username.domain/Doc...
by bkromer
Tue Jan 04, 2022 10:14 am
Forum: Node.js scripting
Topic: How to use flowElement.createJob to save a writeStream
Replies: 3
Views: 3651

Re: How to use flowElement.createJob to save a writeStream

mkayyyy wrote: Tue Jan 04, 2022 9:53 am You'll need to use a library like https://www.npmjs.com/package/tmp to create a temp file to write to

.....
Thanks for the snippet, works perfectly! :)
by bkromer
Tue Jan 04, 2022 9:24 am
Forum: Node.js scripting
Topic: How to use flowElement.createJob to save a writeStream
Replies: 3
Views: 3651

How to use flowElement.createJob to save a writeStream

Hey I want to download a file with axios how can I create a tempfile for sendToSingle? ...const response = await axios({ method: 'GET', url: fileUrl, responseType: 'stream', }); const writer = response.data.pipe(fs.createWriteStream(tempFilePath)); I read in the docs that createPathWithName is not s...
by bkromer
Thu Dec 16, 2021 2:20 pm
Forum: Node.js scripting
Topic: stdout as opaque dataset, how does it work?
Replies: 5
Views: 4900

Re: stdout as opaque dataset, how does it work?

Thank you both. I will use the free App Run Command. :D
by bkromer
Tue Dec 14, 2021 11:24 am
Forum: Node.js scripting
Topic: How to WebHooks in NodeJS
Replies: 1
Views: 2022

How to WebHooks in NodeJS

Hey there, I read in the documentation that it is also possible to register and handle WebHooks from a NodeJS script. https://www.enfocus.com/manuals/DeveloperGuide/SW/21.1/home.html#en-us/common/swscr/reference/re_swscr_entrypoints.html But I don't understand the example code. I want to register a ...
by bkromer
Tue Dec 14, 2021 10:56 am
Forum: Node.js scripting
Topic: stdout as opaque dataset, how does it work?
Replies: 5
Views: 4900

Re: stdout as opaque dataset, how does it work?

Hey jan, when I use the "Export Metadata"-element it gives me three ways of exporting the opaque Dataset. File, File+protocoll and protocoll. Protocoll gives me a *.opaque file. I can then read the opaque file and my stdout is written to it. So far so good. Is there a way of doing this pro...