snipp-gg/snipp-js
@snipp-gg/snipp
Installation
fetch and FormData.
Getting Started
Methods
getUser(id, options?)
Fetch a user by ID. Pass "@me" for the authenticated user.
| Option | Type | Description |
|---|---|---|
includePosts | boolean | Include the user’s public uploads. |
postsLimit | number | Number of posts to return (1 to 50). |
getPost(code)
Fetch a post by its share code.
upload(file, options?)
Upload a file. Accepts a File, Blob, Buffer, or Uint8Array.
| Option | Type | Description |
|---|---|---|
privacy | "public" | "unlisted" | "private" | Visibility of the upload. |
filename | string | Filename sent with the upload (defaults to "upload"). |
title | string | Optional post title (max 30 chars). |
description | string | Optional post description (max 200 chars). |
postType | "album" | "individual" | album (default) or individual. Only applies when uploading two or more files. |
listUploads(options?)
List the authenticated user’s recent uploads. Defaults to 30. Pass limit to control the count (max 1000).
| Option | Type | Description |
|---|---|---|
limit | number | Maximum uploads to return (1-1000). |
editUpload(code, options)
Edit an existing upload’s title, description, or privacy.
| Option | Type | Description |
|---|---|---|
title | string | New title (max 30 chars). Empty string to clear. |
description | string | New description (max 200 chars). Empty string to clear. |
privacy | "public" | "unlisted" | "private" | New visibility setting. |
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.
| Parameter | Type | Description |
|---|---|---|
code | string | Share code of the post to append to. |
files | Array<File | Blob | Buffer | Uint8Array> | One or more files to append. |
options.filenames | string[] | Optional filenames (one per file). |
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 aSnippError with status and message properties.

