Import Module for QNAP Notes Station export

I'm just implementing an import module. First I implemented the functionality in Python. I used the requests module to access the data api. All worked fine.
Now I'm trying to convert the implementation to Joplin/Javascript. At the moment I have 2 problems:

  1. I got an exception when posting ['auth'] to the data api. (there is no function dispatch). The same (e.g. /auth) works with curl in Windows Powershell.
  2. I cannot post resources as byte arrays with the post method. In Python I got it working. Is there a possibility to do it this way? I want to circumvent the creation of local files and do work with buffers only.
    This is my piece of code where I post the binary content to Joplin:
	public post_resource = async function(meta_data: any, content: Uint8Array) : Promise<any>
	{
		try
		{
			var title = meta_data['title'];
			var metadata = JSON.stringify(meta_data);
			var metadata_encoded = this.encoder.encode(metadata);
			var data = { props: [null, metadata_encoded], data: [title, content] };
			var resp = await this.post(['resources'], { }, null, data);
		
			return resp;
		}
		catch (e)
		{
			console.error('Exception in Joplin.post_resource: ' + e);
			return { id: 'phantasy.pdf', title: title };
		}
	}

Can anyone help?

I suppose you don't need to authenticate when your plugin is already running inside Joplin.

Indeed, it works. Thank you!

In the meantime I write the resource to a temp file and provide a path to api. It works. Problem solved!