Automatically migrated from Gitolite
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
Sven Slootweg 0cb24a67f7 Update repository URL pirms 9 gadiem
lib v1.0.0 pirms 9 gadiem
.gitignore .gitignore created by brackets-git extension pirms 9 gadiem
README.md v1.0.0 pirms 9 gadiem
gulpfile.js v1.0.0 pirms 9 gadiem
index.coffee v1.0.0 pirms 9 gadiem
index.js v1.0.0 pirms 9 gadiem
package.json Update repository URL pirms 9 gadiem

README.md

ia-headers

This module converts an object containing metadata into valid HTTP headers for the Internet Archive S3 API.

This is not a full-blown API client - it simply generates the metadata headers. You can use a module like bhttp to interact with the API. The documentation for the Internet Archive S3 API can be found here. API keys can be obtained here.

ia-header supports multiple values for a metadata field - simply pass them in as an array (see also the Usage example below). Underscores are translated into double dashes, as per the IA S3 documentation.

License

WTFPL or CC0, whichever you prefer. A donation and/or attribution are appreciated, but not required.

Donate

My income consists entirely of donations for my projects. If this module is useful to you, consider making a donation!

You can donate using Bitcoin, PayPal, Gratipay, Flattr, cash-in-mail, SEPA transfers, and pretty much anything else.

Contributing

Pull requests welcome. Please make sure your modifications are in line with the overall code style, and ensure that you're editing the .coffee files, not the .js files.

Build tool of choice is gulp; simply run gulp while developing, and it will watch for changes.

Be aware that by making a pull request, you agree to release your modifications under the licenses stated above.

Caveats

  • Metadata keys (not values!) may only be ASCII. The Internet Archive does not currently support non-ASCII metadata keys.
  • All non-ASCII and non-printable characters in metadata values are URL-encoded - this could cause potentially significant header size increases. In most cases, this won't matter.

Usage

var iaHeaders = require("ia-headers");

var metadata = {
	subject: ["mirror", "pdf.yt"],
	mediatype: "texts",
	collection: "pdfymirrors",
	date: "2014-03-01",
	title: "Some Document (PDFy mirror)",
	description: "This is a document from PDFy.<br>It's a mirror."
}

var metadataHeaders = iaHeaders(metadata);
console.log(metadataHeaders);

/* Result:
{ 'x-archive-meta1-subject': 'mirror',
  'x-archive-meta2-subject': 'pdf.yt',
  'x-archive-meta-mediatype': 'texts',
  'x-archive-meta-collection': 'pdfymirrors',
  'x-archive-meta-date': '2014-03-01',
  'x-archive-meta-title': 'Some Document (PDFy mirror)',
  'x-archive-meta-description': 'This is a document from PDFy.<br>It\'s a mirror.' }
*/