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-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"). |
listUploads()
List the authenticated user’s recent uploads.
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. |
deleteUpload(filename)
Delete an upload by its filename.
discover()
Browse public uploads from the community.
listBlocks()
List the users you have blocked.
blockUser(targetId)
Block a user by their ID.
unblockUser(targetId)
Unblock a user by their ID.
Error handling
All API errors throw aSnippError with status and message properties.

