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 🙏

© 2024 – Pkg Stats / Ryan Hefner

atom-writer

v1.1.2

Published

To generate ATOM feeds quickly

Downloads

3

Readme

ATOMWriter for NodeJS

ATOMWriter is small class, that provides methods to generate an ATOM feed. XML is still valid by using XMLWriter

Contributors

Installation

With npm do:

$ npm install atom-writer

Examples

Basic


var XMLWriter = require('xml-writer')
var ATOMWriter = require('atom-writer')

xw = new XMLWriter(true)
aw = new ATOMWriter(xw)

aw
  .startFeed('urn:xxx:yyy')
  .writeStartIndex(1)
  .writeItemsPerPage(10)
  .writeTotalResults(100)
  .writeTitle('Index of /')
  .writeLink('http://exemple.com/feed.xml', 'application/atom+xml', 'self')

aw
  .startEntry('urn:xxx:yyy-1')
  .writeTitle('Data 1')
  .writeLink('/1.xml', 'text/xml')
  .writeLink('/1.txt', 'text/plain')
  .writeContent('Un', 'text', 'fr')
  .writeAuthor('Tata Toto', '[email protected]')
  .writeCategory('term', 'http://exemple.com#scheme')
  .endEntry()

aw
  .startEntry('urn:xxx-yyy-2')
  .writeTitle('Data 2')
  .writeLink('2.txt', 'text/plain')
  .writeContent('deux', 'text', 'fr')
  .writeAuthorRAW('[email protected]')
  .endEntry()

aw
  .endFeed()

console.log(xw.toString())

Output:

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
  <id>urn:xxx:yyy</id>
  <updated>2012-07-02T15:22:40Z</updated>
  <opensearch:startIndex>1</opensearch:startIndex>
  <opensearch:itemsPerPage>10</opensearch:itemsPerPage>
  <opensearch:totalResults>100</opensearch:totalResults>
  <title type="text">Index of /</title>
  <link type="application/atom+xml" href="http://exemple.com/feed.xml" rel="self"/>
  <entry>
    <id>urn:xxx:yyy-1</id>
    <updated>2012-07-02T15:22:40Z</updated>
    <published>2012-07-02T15:22:40Z</published>
    <title type="text">Data 1</title>
    <link type="text/xml" href="/1.xml"/>
    <link type="text/plain" href="/1.txt"/>
    <content type="text" xml:lang="fr">Un</content>
    <author>
      <name>Tata Toto</name>
      <email>[email protected]</email>
    </author>
    <category term="term" scheme="http://exemple.com#scheme"/>
  </entry>
  <entry>
    <id>urn:xxx-yyy-2</id>
    <updated>2012-07-02T15:22:40Z</updated>
    <published>2012-07-02T15:22:40Z</published>
    <title type="text">Data 2</title>
    <link type="text/plain" href="2.txt"/>
    <content type="text" xml:lang="fr">deux</content>
    <author>
      <name>titi.toto</name>
      <email>[email protected]</email>
    </author>
  </entry>
</feed>

API Documentation

construct (XMLWriter o)

flush()

startFeed(String id, Date updated = null, Date created = null)

writeTitle(String value, String type = 'text', String lang = null)

writeLink(String value, String type = 'text/html', String rel = null)

writeAuthor(String name, String email = null, String uri = null)

writeAuthorRAW(String value)

writeContributor(String name, String email = null, String uri = null)

writeCategory(String term, String scheme = null, String label = null)

startEntry(String id, Date updated = null, Date created = null)

writeContent(String value, String type = null, String lang = null)

endEntry()

endFeed()

writeSearch(String url)

writeTotalResults(String value)

writeStartIndex(String value)

writeItemsPerPage(String value)

writeQuery(String searchTerms, Number startPage = 1, String role = 'request')

writeGenerator(String value, String version = null, String uri = null)

Also

  • http://dojotoolkit.org/reference-guide/1.7/dojox/atom/io/model.html
  • https://github.com/wezm/node-genx

License

MIT/X11