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

soundcloud-wrapper

v0.9.10

Published

Node wrapper for the SoundCloud API

Readme

Soundcloud Wrapper ☁️

Soundcloud Wrapper is a fully open source, lightweight, strongly-typed Node.js wrapper for the Soundcloud API. It simplifies interaction with SoundCloud's services by providing an intuitive interface for authentication, track management, playlist operations, and user interactions. Built with TypeScript, it offers full type safety and seamless integration for Node.js applications.

Docs

🔗 https://soundcloud-wrapper-docs.vercel.app/docs

Usage

Please visit the docs for full guide on usage. The code samples below are to be seen as guidelines rather than straight copy and paste working solutions. Amend apporopriately to fit your tech stack/use case.

Get And Store Token

import { Request, Response } from "express"
import Token from "../models/token"
import axios from "axios"
import qs from "qs"

export const getAccessToken = async (req: Request, res: Response) => {
  // code in ?code= query from your redirectUri/frontend
  const codeFromFrontend = req.query.code
  // handle this however you need to, but ensure the logged in users userId is passed so it can be linked to the token later
  const userId = req.userId

  // build query to be passed to request
  let data = qs.stringify({
    grant_type: "authorization_code",
    client_id: process.env.CLIENT_ID,
    client_secret: process.env.CLIENT_SECRET,
    redirect_uri: process.env.REDIRECT_URI,
    code_verifier: process.env.PKCE_CODE_VERIFIER,
    code: codeFromFrontend,
  })

  // define config for request
  let config = {
    method: "POST",
    maxBodyLength: Infinity,
    url: "https://secure.soundcloud.com/oauth/token",
    headers: {
      accept: "application/json; charset=utf-8",
      "Content-Type": "application/x-www-form-urlencoded",
    },
    // pass query built above
    data: data,
  }

  // send request to get token
  const tokenRequest = await axios
    .request(config)
    .then((response) => {
      // upon success return token
      return response.data
    })
    .catch((error) => {
      // if request fails log error
      console.log(error)
      throw new Error("Failed to get access token")
    })

  // link logged in userId to token
  const tokenWithUserId = { ...tokenRequest, id: userId }

  // save token with userId to DB
  const token = new Token(tokenRequest)
  await token.save()

  return res.status(201).json({ message: "Successfully created token" })
}

Use Token

import { Request, Response } from "express"
import Token from "../models/token"
import axios from "axios"

export const getMe = async (req: Request, res: Response) => {
  try {
    // get token from DB
    const token = await Token.findById(req.userId)

    // define config for request
    let config = {
      method: "get",
      maxBodyLength: Infinity,
      url: `https://api.soundcloud.com/me`,
      headers: {
        accept: "application/json; charset=utf-8",
        "Content-Type": "application/json; charset=utf-8",
        // pass token to request
        Authorization: `Bearer ${token}`,
      },
    }

    // send request to get details of authenticated user
    const me = await axios
      .request(config)
      .then((response: any) => {
        // upon success return user data
        return response.data
      })
      .catch((error: any) => {
        // if request fails log error
        console.log(error)
        throw new Error("Failed to get me")
      })
    // return data of authenticated user
    return res.status(200).json(me)
  } catch (e) {
    console.error(e)
    throw new Error("Failed to get me")
  }
}