1.0.5 • Published 6 years ago

react-native-save-asset-library v1.0.5

Weekly downloads
3
License
MIT
Repository
-
Last release
6 years ago

react-native-save-asset-library NPM version

A React Native module for saving asset-library:// paths to the documents folder

Getting started

  1. npm install react-native-save-asset-library --save
  2. In XCode, in the project navigator, right click your projectAdd Files to [your project's name]
  3. Go to node_modulesreact-native-save-asset-library and add SaveAssetLibrary.m
  4. Run your project (Cmd+R)

Usage

var SaveAssetLibrary = require('react-native-save-asset-library');

var obj = {
    imagePath: "asset-library://", // (required) Path to asset-library:// for example from CameraRoll
    imageName: "imageName", // (required) This is what you want the image to be named
    imageType: "jpg", // (optional) "png" or "jpg".  Default it jpg.  More image types could be supported send me a pull request
    width: 2048, // (optional) Size of the image to be saved. Default is 2048
    height: 2048, // (optional) Size of the image to be saved. Default is 2048
};
var successCallBack = (imagePath)=>{
    // image has been saved.
    console.log('Path: ' + imagePath);
};
var errorCallback = (error)=>{
    console.log('error: ', error);
};
SaveAssetLibrary.SaveImage(obj, successCallack, errorCallback);

Road Map, Feature Requests & Bug Fixes

I will add to this module as I need more features and I hope you will too, pull requests are always welcome. I will not add features on request because I'm busy with other projects. I want this to be a community written module so if there is a feature that's missing or bug, add it or fix it and send me a pull request. If you don't know Objective C you can learn it. We all were where you are now at some point. StackOverflow.com is your friend. :)

Features that could be added:

License

The MIT License (MIT)

Copyright (c) 2015 Tom Krones

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.