Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@axway-api-builder-ext/api-builder-plugin-fn-file

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@axway-api-builder-ext/api-builder-plugin-fn-file

File Flow-Node to read/write files as part of an API-Builder flow.

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status

API-Builder File Flow-Node

This node can be used to read and write files in your API-Builder flow.

The following file types are supported/planned:

File TypeDescriptionStatus
CSVYou can read/write from and to CSV-Files, filter records and columns and directly convert it into a JavaScript objectSupport for Read
JSONYou can read/write from and to JSON-Files and directly convert it into a JavaScript objectPlanned
XMLYou can read/write from and to XML-Files and directly convert it into a JavaScript objectPlanned
Plain-TextJust read and write plain textPlanned

CSV Files

With this flow-node you can read CSV-File and make the content available to your flow. With that, you can for instance enrich data taken from the CSV-File and merge it with data you got before.

Read

To Read a CSV-File, you have to make it available to the API-Builder project. For instance putting it directly into your API-Builder app and reference it then with a relative path.

Input parameters

The CSV Read-Operation supports a number of input parameters:

ParamTypeRequiredDescription
filenamestringyThe name of the CSV file you would like to read. This file is given either absolute or relative to the API-Builder project. For instance, when putting a file into conf/my-file.csv you just configured conf/my-file.csv
delimiterstringnThe delimeter of your CSV-File. Defaults to , Configure any other character, when your CSV-File is splitting records differently.
filterColumnstringnThe CSV column name used to filter using the filterValues. This parameter is ignored, if filterValues is not set.
filterValuesstring|arraynThis value is used to filter entries in the configured filterColumn. It can be either a simple string or an array of string. The parameter is case-sensitve. This parameter is ignored, if filterColumn is not set.
uniqueResultbooleannTurn this on if you require a unique result (exactly 1). If not unique or nothing is found the flow node fails.
resultColumnsarraynAn array of CSV column names you want in the result. The column names are expected in the first line or using the parameter: columnsyou can override the column names. Example: ["columnA", "columnF", "columnT"]
quotestringnOptional character surrounding a field. This is required, when the delimiter is used as part of a field; one character only. The default is double quote.
commentstringnTreat all the characters after this one as a comment. Used this, when your CSV-File contains lines with comments. E.g. using a #
columnsarraynProvide an array of column headers if your CSV has NO headers or you would like to have different field names.
relax_column_countbooleannDiscard inconsistent columns count. If a column is missing for a record a reduced dataset is returned.

Output

The content from the CSV-File is converted into a Java-Script object, so that you can easily use it in your flow.

For instance the following input:

ReturnCode, ResponseMessage, LastUpdate, Author
401, You have no permission, 16.01.2020, Chris
500, Internal server error, 17.01.2020, Charles

is made available to the flow as the following object:

{
  ReturnCode: '401',
  ResponseMessage: 'You have no permission',
  LastUpdate: '16.01.2020',
  Author: 'Chris'
},
{
  ReturnCode: '500',
  ResponseMessage: 'Internal server error',
  LastUpdate: '17.01.2020',
  Author: 'Charles'
}

When using the default output attribute: $.content you can access the data inside your flow like so: $.content.1.ReturnCode to get the second return-code.

Using the parameters: filterColumn, filterValues and uniqueResult you can limit the data to one record. In that case, the data is always stored in the first object: $.content.0.ReturnCode

Write

This is not yet supported. Please create an issue describing your use-case, if you need support for it.

JSON Files

Read

This is not yet supported. Please create an issue describing your use-case, if you need support for it.

Write

This is not yet supported. Please create an issue describing your use-case, if you need support for it.

XML Files

Read

This is not yet supported. Please create an issue describing your use-case, if you need support for it.

Write

This is not yet supported. Please create an issue describing your use-case, if you need support for it.

Plain Text

Read

This is not yet supported. Please create an issue describing your use-case, if you need support for it.

Write

This is not yet supported. Please create an issue describing your use-case, if you need support for it.

After creating your API Builder service (api-builder init), you can install this plugin using npm:

npm install api-builder-plugin-fn-file

Changelog

See Change-Log

Keywords

FAQs

Package last updated on 30 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc