Skip to content

A demo application that extends the `npm contexter` metadata extraction capability to images also

Notifications You must be signed in to change notification settings

elingerojo/contexter-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

travis-badge

contexter-cli

A demo application that extends the npm contexter metadata extraction capability to images also

This is a complete application to show the core contexter library capabilities

Reactively extract all available data from files (including images) in a directory to one javascript object

dir-with-images-to-jsObject-240x135

contexter-cli has two commands, serve and write. Both accept a directory path

  • serve shows the context object generated in a browser window
  • write writes the context object generated to a file or console

Usage

Sample dir structure

dir/
|-- assets/
|   |-- photo.jpg   <--- metadata like 'colors'
|   |-- style.css
|   `-- posts.yml
|
|-- index.html
|-- README.md
`-- notes.txt

CLI

contexter-cli serve .

terminal output

Started contexting dir...
  /assets/photo.jpg added
  /assets/posts.yml added
.done!
The server now is running at http://localhost:3000

[BS] Access URLs:
 -------------------------------------
          UI: http://localhost:3001
 -------------------------------------
 UI External: http://192.168.15.6:3001
 -------------------------------------
[BS] Watching files...

Open browser to http://localhost:3000

You will see the directory structure and a dynamic context JavaScript object that mirrors it

homepage.png

The result is a reactive context variable equivalent to:

var context = {
              dir: {
                    assets: {
                          "photo.jpg": {
                                  colors: [
                                        "#bbbbbb",
                                        "#080808",
                                        "#5c5c5c",
                                        "#787878",
                                        "#646464"
                                        ], ...
                            },
                          "posts.yml": {...}
                    },
              datafiles: [
                    {...}   // posts.yml
                    ],
              images: [
                    {...}   // photo.jpg
                    ],
              unknowns: [
                    ]       // empty
            }

Getting started

1.- Install with npm:

npm install contexter-cli --global

2.- Then run the command serve with a path to the directory

contexter-cli serve <path-to-dir>

3.- Wait for the following output

...
.done!
The server now is running at http://localhost:3000

[BS] Access URLs:
 -------------------------------------
          UI: http://localhost:3001
 -------------------------------------
 UI External: http://192.168.15.6:3001
 -------------------------------------
[BS] Watching files...

4.- In a browser open http://localhost:3000

5.- Play with the dynamic context JavaScript object

...it is reactive, you can update files while the App is running to see the changes in the browser live!

Acknowledgements

  • @zeke Thanks for your ideas, code and time

License

The MIT License (MIT)

Copyright (c) 2017 Eduardo Martinez

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.

About

A demo application that extends the `npm contexter` metadata extraction capability to images also

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published