staticresource Commands (Deprecate)

force:staticresource:create (Deprecate)

Creates a static resource in the specified directory or the current working directory. The resource folder and associated metadata file are created.

As of February 16, 2023, this command is deprecated and we no longer update this topic.

Don't worry, this command and its flags continue to work the same as before, and any scripts that use the command won’t break. However, we recommend that you start using the equivalent sf-style static-resource generate command instead. Here’s how the flags changed between the old and new commands; if a flag isn't listed, the old and new names are the same:

  • Removed flag: --loglevel
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --outputdir. New name: --output-dir.
  • Changed flag name: Old name --resourcename. New name: --name.

For background information about this change, read this blog post, which describes how we've updated many of the existing sfdx commands to use the improvements we made in sf. We improved this particular command on February 16, 2023.

Warning

Help for force:staticresource:create

If not supplied, the apiversion, template, and outputdir use default values.

The outputdir can be an absolute path or relative to the current working directory.

Examples:

1sfdx force:staticresource:create -n MyResource
1sfdx force:staticresource:create -n MyResource --contenttype application/json
1sfdx force:staticresource:create -n MyResource -d staticresources

Command Syntax

sfdx force:staticresource:create
[--json]
[--loglevel LOGLEVEL]
-n RESOURCENAME
[--contenttype CONTENTTYPE]
[-d OUTPUTDIR]
[--apiversion APIVERSION]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sf/sf.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-n | --resourcename RESOURCENAME
Required

The name of the new static resource. This name can contain only underscores and alphanumeric characters, and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores.

Type: string
--contenttype CONTENTTYPE
Optional

The content type of the generated static resource. This must be a valid MIME type such as application/json, application/javascript, application/zip, text/plain, text/css, etc.

Type: string
Default value: application/zip
-d | --outputdir OUTPUTDIR
Optional

The directory to store the newly created files. The location can be an absolute path or relative to the current working directory. The default is the current directory.

Type: string
Default value: .
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string