WARNING: The [sjs-3] engine was deprecated, use [sjs-4] instead.

File.prototype.attrStr()

Get/set string file attributes.

Syntax

file.attrStr(key string) string file.attrStr(key string, value string) File

When setting file attributes, the file itself is returned so that method calls are chainable.

Parameters

key string

Name of the attribute.

value string

Value to store.

Description

Get/set user defined string file attributes. When an attribute is not defined on the file, reading it returns the empty value of the type, which is an empty string in case of string.

The maximum length of a string attribute equals that of the file body.

Examples

Get/set value.

Getting undefined attribute.

Setting attribute on response file.