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

ng-filedialog

v1.0.0

Published

angular file dialog for nwjs

Downloads

3

Readme

ng-fileDialog

angular file dialog for nw

What is it

This is a simple module for node-webkit applications written with AngularJS. It provides a service called fileDialog which allows you to show the user file dialogs like "save as" or "open file". You can find more information in the File dialogs section of node-webkit's wiki.

This module allows you to

  • Call "Save as" dialog
  • Call "Open file" dialog
  • Call "Open directory" dialog
  • Provide filters by file types
  • Allow user to select multiple files
  • Specify a default name for the file

Dependencies

  1. AngularJS
  2. nw

Usage

  1. Include the script into your HTML document after the AngularJS.
<script src="path/to/the/angular.js"></script>
<script src="path/to/the/ng-fileDialog.js"></script>
<script src="path/to/the/your-app-code.js"></script>
  1. Inject ng-fileDialog as dependency into your module.
var app = angular.module('app', ['ng-fileDialog']);
  1. Use the provided fileDialog service
app.controller('SomeCtrl', function($scope, fileDialog) {
    $scope.saveFile = function() {
      fileDialog.saveAs(function(filename) {
        // your code
      });
    };
});

API

fileDialog.selectFile(callback, acceptTypes)

Opens the "open file" dialog, which allows the user to choose some file.

callback - function - function, which will be called if the user choose the file and clicks OK button. Required interface: function(files).

acceptTypes - string/array - an array of accepted file types. See HTML5 specification.

fileDialog.selectFiles(callback, acceptTypes)

Opens the "open files" dialog, which allows the user to choose some file.

callback - function - function, which will be called if the user choose the file and clicks OK button. Required interface: function(files).

acceptTypes - string/array - an array of accepted file types. See HTML5 specification.

fileDialog.selectDir(callback)

Opens the "open directory" dialog, which allows the user to choose some directory.

callback - function - function, which will be called if the user choose the directory and clicks OK button. Required interface: function(file).

fileDialog.saveAs(callback, defaultFilename, acceptTypes)

Opens the "save as" dialog, which allows the user to input a name of the file to be saved.

callback - function - function, which will be called if the user enters a name of the file to save and clicks OK button. Required interface: function(file).

defaultFilename - string - a default name of the file. Can be omitted by setting false.

acceptTypes - string/array - an array of accepted file types. See HTML5 specification.

fileDialog.open(options, callback)

Opens dialog.

options - Object - options.

multiple - *boolean * - a flag which the user to select multiple files. Default = false.

accept - string/array - an array of accepted file types.

webkitdirectory - boolean - WebKit show a directory select dialog. Default = false.

nwdirectory - boolean - node-webkit show a directory select dialog. Default = false.

nwworkingdir - string - default directory.

nwsaveas - boolean/string - open a 'save as' dialog, which lets user enter the path of a file. It's possible to select a non-existing file.

callback - function - function, which will be called if the user enters a name of the file to save and clicks OK button. Required interface: function(file).

Important note

Please, keep in mind that there is no warranty that the callback function will be called each time you call any of the provided methods. If the user clicks the Cancel button the callback will not be called!