npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@goofmint/growi-js

v1.1.5

Published

This is a SDK for [GROWI](https://growi.org/) written in node.js.

Downloads

31

Readme

Growi node.js SDK

This is a SDK for GROWI written in node.js.

Installation

$ npm install @goofmint/growi-js

Usage

Create a client

import { GROWI } from '@goofmint/growi-js';
const growi = new GROWI({apiToken: 'YOUR_API_TOKEN'});

Initialize parameters are as follows:

| Parameter | Description | | --------- | ----------- | | apiToken | API token for GROWI. You can get it from the setting page of GROWI. | | url | URL of GROWI. Default is http://localhost:3000. | | path | Endpoint path of Growi API. Default is /. |

Get root page

const page = await growi.root();
page instanceof growi.Page; // true

Get children of a page

const pages = await page.children();
pages[0] instanceof growi.Page; // true

Update page contents

page.contents('New contents');
await page.save();

Get contents of a page

const contents = await page.contents();

Create a page

const newPage = await page.create({name: 'New page'});

Remove a page

await page.remove();

Tag

Get tags of a page

const tags = await page.tags();

Add a tag to a page

await page.addTag('tag');

Remove a tag from a page

await page.removeTag('tag');

Comment

Get comments of a page

const comments = await page.comments();

Add a comment to a page

const comment = page.comment();
comment.set('comment', 'New comment');
await comment.save();

Update a comment

comment.set('comment', 'Updated comment');
await comment.save();

Remove a comment

await comment.remove();

Search

Search pages

const result = await growi.search({q: 'keyword'});
result.pages[0] instanceof growi.Page; // true
result.total // total number of pages
result.took // time taken for search
result.hitsCount // number of hits

Search by tag

const result = await growi.searchByTag('tag');
result.pages[0] instanceof growi.Page; // true
result.total // total number of pages
result.took // time taken for search
result.hitsCount // number of hits

Attachment

Upload an attachment

const page = await growi.page({path: '/API Test'});
const fileName = 'logo.png';
const attachment = await page.upload(path.resolve("jest", fileName));
attachment // Attachment instance

Get attachments of a page

const page = await growi.page({path: '/API Test'});
const res = await Attachment.list(page);
res.attachments // array of Attachment instances
res.limit // 10
res.page // 1
res.totalDocs // 20

Check uploadable file size

const bol = await Attachment.limit(1024 * 1024 * 10);
bol // true

Find attachment

const a = await Attachment.find(attachment.id!);
a // Attachment instance

User

Get current user

const user = await growi.currentUser();

Bookmark Folder

Get bookmark folders

const bookmarkFolders = await user.bookmarkFolders();

Create a bookmark folder

const bookmarkFolder = new BookmarkFolder();
bookmarkFolder.name = 'my folder';
await bookmarkFolder.save();

Update a bookmark folder

bookmarkFolder.name = 'my folder updated';
await bookmarkFolder.save();

Remove a bookmark folder

await bookmarkFolder.remove();

Create a bookmark folder in a folder

const bookmarkFolder = new BookmarkFolder();
bookmarkFolder.name = 'Parent';
await bookmarkFolder.save();
const bookmarkFolder2 = new BookmarkFolder();
bookmarkFolder2.name = 'Child';
bookmarkFolder2.parent = bookmarkFolder;
await bookmarkFolder2.save();

Or

const bookmarkFolder = new BookmarkFolder();
bookmarkFolder.name = 'Parent';
const bookmarkFolder2 = new BookmarkFolder();
bookmarkFolder2.name = 'Child';
await bookmarkFolder.addFolder(bookmarkFolder2);

Move a bookmark folder

const bookmarkFolder3 = new BookmarkFolder();
bookmarkFolder3.name = 'New parent';
bookmarkFolder3.parent = bookmarkFolder2;
await bookmarkFolder3.save();

Fetch folder info

await bookmarkFolder.fetch();

Bookmark

Get my bookmarks

const bookmarks = await user.bookmarks();

Get bookmark info of a page

const page = await growi.root();
const info = await page.bookmarkInfo();
info.bookmarkCount // number of bookmarks
info.bookmarked    // true if the page is bookmarked by the current user
info.users         // array of users who bookmarked the page

Bookmark a page

await user.bookmark(page); // unbookmark

Unbookmark a page

await user.bookmark(page, false); // unbookmark

Check if a page is bookmarked

const bol = await user.isBookmarked(page);

Add bookmark to a folder

const folder = new BookmarkFolder();
folder.name = 'my folder';
await folder.save();
await folder.addPage(page);

License

MIT