Skip to main content
static getElement(notePath: string, page: number, num: number): Promise<APIResponse<Element>>;
Parameters
ParameterTypeDescription
notePathstringNote file path
pagenumberPage index (starting from 0)
numnumberElement index within the page (starting from 0)
Returns

Example

import { PluginFileAPI } from 'sn-plugin-lib';

/**
 * Example: get a single element from a note page.
 */
export async function exampleGetElement() {
  const notePath = '/storage/emulated/0/Note/demo.note';
  const page = 0;
  const num = 0;

  const res = await PluginFileAPI.getElement(notePath, page, num);
  if (!res.success) {
    throw new Error(res.error?.message ?? 'getElement call failed');
  }
  return res.result;
}