Skip to main content

snipp-gg/snipp-js

@snipp-gg/snipp

Installation

Requires Node.js 18 or later. Zero dependencies. Uses native fetch and FormData.

Getting Started

Methods

getUser(id, options?)

Fetch a user by ID. Pass "@me" for the authenticated user.

getPost(code)

Fetch a post by its share code.

upload(file, options?)

Upload a file. Accepts a File, Blob, Buffer, or Uint8Array.

listUploads(options?)

List the authenticated user’s recent uploads. Defaults to 30. Pass limit to control the count (max 1000).

editUpload(code, options)

Edit an existing upload’s title, description, or privacy.

appendUpload(code, files, options?)

Add one or more files to an existing album post. The post’s share code, privacy, title, and description are preserved. Albums cap at 9 files total. Requests that would exceed the cap are rejected. New files inherit the post’s privacy. Returned URLs are signed with a 24-hour expiry for private posts.

deleteUpload(filename)

Delete an upload by its filename. On albums, only that file is removed; on single-file posts the entire post is deleted.

Error Handling

All API errors throw a SnippError with status and message properties.