Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including bitbucket-snippet with all npm packages installed. Try it out:

var bitbucketSnippet = require("bitbucket-snippet")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

bitbucket-snippet v0.0.6

A command-line tool for creating snippets via the Bitbucket REST API.

Bitbucket Snippet

CLI tool for publishing a local file as a Bitbucket Snippet.

You may enjoy this article on how this tool was built.


 snippet [options] <file>


    -h, --help                 output usage information
    -u, --username <username>  the user to authenticate as
    -p, --password <password>  the user's password
    -b, --browser              open the snippet in the system browser


  • Install Node.js and npm
  • Run npm install -g bitbucket-snippet
  • Run snippet --help or snippet some_file to upload it to Bitbucket.

Credential management

The first time you upload a file you will be prompted for your Bitbucket username and password. These will be used to retrieve an OAuth refresh token which is stored in ~/.bitbucket-snippet and used for subsequent requests. Treat this token carefully as it can be used to read and write snippets on your behalf.


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free