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

Example

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

/**
 * Example: get the number of elements on a note page.
 */
export async function exampleGetElementCounts() {
  const notePath = '/storage/emulated/0/Note/demo.note';
  const page = 0;

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