Create resource

Hi,

I am currently trying to create a resource from a local file via plugin.
But I don't get figured out, know how the command/code for uploading is correct, because I get every time a Resource cannot be created without a file.

const localFile = "c:/temp/test.jpg";
const resource = await joplin.data.post(["resources"], null, ????

Does anyone have a code snippet for how I can achieve this?

Thanks
Alex

I think that should work, but I didn't test. Basically you pass the file object as the last argument.

await joplin.data.post(
	["resources"],
	null,
	{ title: "test.jpg" }, // Resource metadata
	[
		{
			path: "/path/to/test/jpg", // Actual file
		},
	]
);