![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
@era86/random-reddit
Advanced tools
The set of functions that get random posts or images from specified subreddit.
npm install random-reddit
getPost()
or getImage()
from the package.const { getPost, getImage } = require('random-reddit')
function async getPost() {
const post = await getPost('memes')
console.log(post) // returns the reddit post object
// ...
}
function async getImage() {
const image = await getImage('memes')
console.log(image) // e.g. https://i.redd.it/sri113wns9351.png
}
You can enable inner logs by setting the environment variable RANDOM_REDDIT_LOG_LEVEL
to a number from -1 (no logs at all) to 5 (every log possible).
RANDOM_REDDIT_LOG_LEVEL=4 node my_app.js
The logs are provided by the consola
package. So the log level can also be changed with CONSOLA_LEVEL
env variable
CONSOLA_LEVEL=4 node my_app.js
Types are provided by the reddit-interfaces
package. It's the peer dependency, so it you have to install it manually, if you use random-reddit
with Typescript.
getPost()
getPost(subreddit: string | string[]): Promise
Returns the whole Reddit post.
Arguments:
subreddit
(string | string[]
) - a subreddit to fetch the post from. You can also specify an array of subreddit names. Make sure there's no r/
part in the value(s)getImage()
getImage(subreddit: string | string[], retryLimit?: number): Promise
Returns the random post's image URL. If it won't find one - the request will be sent again until the retryLimit
is reached.
Arguments:
subreddit
(string | string[]
) - a subreddit to fetch the image from. You can also specify an array of subreddit namesretryLimit
(number
) - optional. Request retry limit. Default is 10.getPostById()
getPostById(id: string, subreddit: string): Promise
Returns specific post with given id (ID36) and specified subreddit.
Arguments:
id
(string
) - post's idsubreddit
(string
) - a subreddit to fetch the post fromFAQs
Random Reddit posts and images
We found that @era86/random-reddit demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.