@getable/json-image-to-cloudinary
Takes a json array and field names. Replaces the value of those field names with a cloudinary url.
Last updated 5 years ago by getable .
Artistic 2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @getable/json-image-to-cloudinary 
SYNC missed versions from official npm registry.

json-image-to-cloudinary NPM version Build Status Dependency Status

Takes a json array and field names. Replaces the value of those field names with a cloudinary url.

Table of Contents generated with DocToc

Install

npm i -S @getable/json-image-to-cloudinary

Usage

CLI

CLOUDINARY_URL=cloudinary://<your url here> && json-image-to-cloudinary data.json -f image

Programmatic

import  from '@getable/json-image-to-cloudinary'

jsonImageToCloudinary(docs, options, callback)

Options

-h, --help

show help

-f, --field | field <String> Required

Field to replace with a cloudinary url

--overwrite | overwriteImages <Boolean>

Overwrite data on cloudinary, use this if your urls changed and you're running the script for a second time

-i, --id | id <String>

Generate a cloudinary id from this string. Access keys in the object with ${}. e.g. --id="${category}/${id}"'

-w, --widths | widths <Array>

CLI: A comma separated list of widths to eagerly compute. Programmatic: An array of integers.

--widths-key | widthsKey <String>

Defaults to field + "s", but you can override here

--width-names | widthNames <Object>

CLI: Name a width for output as an object with width urls e.g. --field=image --widths=50,100 --width-names='small:50,large:100}'

Programmatic: An object of width names that map to widths e.g. `{widths: [50, 100], widthNames: {small: 50, large: 100}}

outputs:

{
  "image": "https://cloudinaryurl",
  "images": {
    "small": "https://cloudinaryurl-at-50",
    "large": "https://cloudinaryurl-at-100"
  }
}

Tests

Tests are in tape.

  • npm test will run the tests
  • npm run tdd will run the tests on every file change.

Developing

To publish, run npm run release -- [{patch,minor,major}]

NOTE: you might need to sudo ln -s /usr/local/bin/node /usr/bin/node to ensure node is in your path for the git hooks to work

Requirements

  • npm > 2.0.0 So that passing args to a npm script will work. npm i -g npm
  • git > 1.8.3 So that git push --follow-tags will work. brew install git

License

Artistic 2.0 © Joey Baker

Current Tags

  • 2.1.6                                ...           latest (5 years ago)

13 Versions

  • 2.1.6                                ...           5 years ago
  • 2.1.5                                ...           5 years ago
  • 2.1.4                                ...           5 years ago
  • 2.1.3                                ...           5 years ago
  • 2.1.2                                ...           5 years ago
  • 2.1.1                                ...           5 years ago
  • 2.1.0                                ...           5 years ago
  • 2.0.0                                ...           5 years ago
  • 1.1.1                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.3                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 13
Dependencies (7)
Dev Dependencies (12)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |