What Happens When You Compress A File

broken image


-->
  1. Best Way To Compress Files
  2. What Does Compressed Files Mean
  3. How To Compress A File To Email
  1. Compress File in Linux. However, the command deletes the original file upon compression as you might have noticed. To retain the original file after compression, run use the -k option as shown. $ pigz -k ubuntu-20.04-beta-desktop-amd64.iso.
  2. You get the option to do cleanup (remove temp files, etc) as well as compress files. The compressed files are still accessible but are just compressed to create space on a drive that is low on space. I also found compress.exe which I did happen to have on my computer. It isn't natively on most windows machines and is part of the 2003 resource kit.

SolutionPackager is a tool that can reversibly decompose a Dynamics 365 Customer Engagement (on-premises) compressed solution file into multiple XML files and other files so that these files can be easily managed by a source control system. The following sections show you how to run the tool and how to use the tool with managed and unmanaged solutions.

Where to find the SolutionPackager tool

At compression 0 the file came in at 526Mb, and when I subsequently tried to compress the file using JRiver I found that I could only get around a 5% compression using level 5, so not worth it. However, when I re-ripped the CD (again using dbPA) and setting it to level 5 the file size came in at 328Mb so about 37% compression, and well worth it. To compress content, a window of the output needs to be buffered up in order to get good compression. Typically when using server-sent events, there are certain block of data that need to reach the client. You can achieve this by calling res.flush when you need the data written to actually make it to the client.

The SolutionPackager tool is distributed as part of the Microsoft.CrmSdk.CoreTools NuGet package. See Download tools from NuGet for information about how to download it.

SolutionPackager command-line arguments

SolutionPackager is a command-line tool that can be invoked with the parameters identified in the following table.

ArgumentDescription
/action: {Extract|Pack}Required. The action to perform. The action can be either to extract a solution .zip file to a folder, or to pack a folder into a .zip file.
/zipfile: Required. The path and name of a solution .zip file. When extracting, the file must exist and will be read from. When packing, the file is replaced.
/folder: Required. The path to a folder. When extracting, this folder is created and populated with component files. When packing, this folder must already exist and contain previously extracted component files.
/packagetype: {Unmanaged|Managed|Both}Optional. The type of package to process. The default value is Unmanaged. This argument may be omitted in most occasions because the package type can be read from inside the .zip file or component files. When extracting and Both is specified, managed and unmanaged solution .zip files must be present and are processed into a single folder. When packing and Both is specified, managed and unmanaged solution .zip files will be produced from one folder. For more information, see the section on working with managed and unmanaged solutions later in this topic.
/allowWrite:{Yes|No}Optional. The default value is Yes. This argument is used only during an extraction. When /allowWrite:No is specified, the tool performs all operations but is prevented from writing or deleting any files. The extract operation can be safely assessed without overwriting or deleting any existing files.
/allowDelete:{Yes|No|Prompt}Optional. The default value is Prompt. This argument is used only during an extraction. When /allowDelete:Yes is specified, any files present in the folder specified by the /folder parameter that are not expected are automatically deleted. When /allowDelete:No is specified, no deletes will occur. When /allowDelete:Prompt is specified, the user is prompted through the console to allow or deny all delete operations. Note that if /allowWrite:No is specified, no deletes will occur even if /allowDelete:Yes is also specified.
/clobberOptional. This argument is used only during an extraction. When /clobber is specified, files that have the read-only attribute set are overwritten or deleted. When not specified, files with the read-only attribute aren't overwritten or deleted.
/errorlevel: {Off|Error|Warning|Info|Verbose}Optional. The default value is Info. This argument indicates the level of logging information to output.
/map: Optional. The path and name of an .xml file containing file mapping directives. When used during an extraction, files typically read from inside the folder specified by the /folder parameter are read from alternate locations as specified in the mapping file. During a pack operation, files that match the directives aren't written.
/nologoOptional. Suppress the banner at runtime.
/log: Optional. A path and name to a log file. If the file already exists, new logging information is appended to the file.
@ Optional. A path and name to a file that contains command-line arguments for the tool.
/sourceLoc: Optional. This argument generates a template resource file, and is valid only on extract.
Possible values are auto or an LCID/ISO code for the language you want to export. When this argument is used, the string resources from the given locale are extracted as a neutral .resx file. If auto or just the long or short form of the switch is specified, the base locale or the solution is used. You can use the short form of the command: /src.
/localizeOptional. Extract or merge all string resources into .resx files. You can use the short form of the command: /loc.

Use the /map command argument

The following discussion details the use of the /map argument to the SolutionPackager tool.

Files that are built in an automated build system, such as .xapSilverlight files and plug-in assemblies, are typically not checked into source control. Web resources may already be present in source control in locations that are not directly compatible with the SolutionPackager tool. By including the /map parameter, the SolutionPackager tool can be directed to read and package such files from alternate locations and not from inside the Extract folder as it would typically be done. The /map parameter must specify the name and path to an XML file containing mapping directives that instruct the SolutionPackager to match files by their name and path, and indicate the alternate location to find the matched file. The following information applies to all directives equally.

  • Multiple directives may be listed including those that will match identical files. Directives listed early in the file take precedence over those listed later.

  • If a file is matched to any directive, it must be found in at least one alternative location. If no matching alternatives are found, the SolutionPackager will issue an error.

  • Folder and file paths may be absolute or relative. Relative paths are always evaluated from the folder specified by the /folder parameter.

  • Environment variables may be specified by using a %variable% syntax.

  • A folder wildcard '**' may be used to mean 'in any sub-folder'. It can only be used as the final part of a path, for example: 'c:folderA**'.

  • File name wildcards may be used only in the forms '*.ext' or '*.*'. No other pattern is supported.

    The three types of directives mappings are described here, along with an example that shows you how to use them.

Folder mapping

What Happens When You Compress A File

Best Way To Compress Files

The following provides detailed information on folder mapping.

Xml Format

Description
File paths that match 'folderA' will be switched to 'folderB'.

  • The hierarchy of subfolders under each must exactly match.

  • Folder wildcards are not supported.

  • No file names may be specified.

    Examples

File To file mapping

The following provides detailed information on file-to-file mapping.

Xml Format

Description
Any file matching the map parameter will be read from the name and path specified in the to parameter.

For the map parameter:

  • A file name must be specified. The path is optional. If no path is specified, files from any folder may be matched.

  • File name wildcards are not supported.

  • The folder wildcard is supported.

    For the to parameter:

  • A file name and path must be specified.

  • The file name may differ from the name in the map parameter.

  • File name wildcards are not supported.

  • The folder wildcard is supported.

    Examples

File to path mapping

The following provides detailed information on file-to-path mapping.

Xml Format

Description
Any file matching the map parameter is read from the path specified in the to parameter.

For the map parameter:

  • A file name must be specified. The path is optional. If no path is specified, files from any folder may be matched.

  • File name wildcards are supported.

  • The folder wildcard is supported.

    For the to parameter:

  • A path must be specified.

  • The folder wildcard is supported.

  • A file name must not be specified.

    Examples

Example mapping

The following XML code sample shows a complete mapping file that enables the SolutionPackager tool to read any web resource and the two default generated assemblies from a Developer Toolkit project named CRMDevTookitSample.

Managed and unmanaged solutions

A Dynamics 365 Customer Engagement (on-premises) compressed solution (.zip) file can be exported in one of two types as shown here.

Managed solution
A completed solution ready to be imported into an organization. Once imported, components can't be added or removed, although they can optionally allow further customization. This is recommended when development of the solution is complete.

Unmanaged solution
An open solution with no restrictions on what can be added, removed, or modified. This is recommended during development of a solution.

The format of a compressed solution file will be different based on its type, either managed or unmanaged. The SolutionPackager can process compressed solution files of either type. However, the tool can't convert one type to another. The only way to convert solution files to a different type, for example from unmanaged to managed, is by importing the unmanaged solution .zip file into a Dynamics 365 Server and then exporting the solution as a managed solution.

The SolutionPackager can process unmanaged and managed solution .zip files as a combined set via the /PackageType:Both parameter. To perform this operation, it is necessary to export your solution twice as each type, naming the .zip files as follows.

Unmanaged .zip file: AnyName.zipManaged .zip file: AnyName_managed.zip

The tool will assume the presence of the managed zip file in the same folder as the unmanaged file and extract both files into a single folder preserving the differences where managed and unmanaged components exist.

After a solution has been extracted as both unmanaged and managed, it is possible from that single folder to pack both, or each type individually, using the /PackageType parameter to specify which type to create. When specifying both, two .zip files will be produced using the naming convention as above. If the /PackageType parameter is missing when packing from a dual managed and unmanaged folder, the default is to produce a single unmanaged .zip file.

Troubleshooting

If you use Visual Studio 2012 to edit resource files created by the solution packager, you may receive a message when you repack similar to this: 'Failed to determine version id of the resource file .resx the resource file must be exported from the solutionpackager.exe tool in order to be used as part of the pack process.' This happens because Visual Studio replaces the resource file's metadata tags with data tags.

Workaround

  1. Open the resource file in your favorite text editor and locate and update the following tags:

  2. Change the node name from to . Gimp paint studio.

    For example, this string:

    Changes to:

    This allows the solution packager to read and import the resource file. This problem has only been observed when using the Visual Studio Resource editor.

See also

Solution Tools for Team Development
Use Source Control with Solution Files
Solution Component File Reference
Introduction to Solutions

Note

Can you tell us about your documentation language preferences? Take a short survey.

The survey will take about seven minutes. No personal data is collected (privacy statement).

When you need to send a file, but it's too big, the first thing that crosses your mind is to compress it. That's usually the fix that most users go for, but you might not be so keen to compressing a file, fearing that essential data could be lost.

Once you know what happens when you compress a file, you might not even think twice about compressing. You know that compressing a file makes it smaller and more comfortable to send, but is that all there is to it?

What Is File Compression?

File compression reduces the size of the file as much as 90%, without losing any of the primary data. Compressing a file is also known as zipping.

What Does Compressed Files Mean

Therefore, file compression helps the user save a considerable amount of disk space. File compression will create a version of one or more files with the same data that's a lot smaller than the uncompressed file.

There are different types of file compression options such as 7z, Zip, StuffIt, RAR, CZIP, and more. Every option uses a distinct compression method.

The person receiving the compressed file will need a program that'll decompress the file back to its normal state. If the receiver doesn't have a program that will open the compressed file, they won't be able to open it.

With File Compression, similar patterns and data are found and are substituted with a different identifier. For example, the word keyboard can be replaced with the number 7 that takes up a lot less space than the word keyboard.

What Changes When You Compress a File – Lossy Compression

There are two main types of file compression: Lossy and Lossless file compression. Lossy compression will take out useless data to help reduce the media file size. For example, in an audio file, there are going to be sounds that humans just can't hear.

Taking out these sounds isn't going to cause any drawbacks that will make the audio file useless. If quality is crucial to you, then you might want to avoid heavily compressing the file or using this type of compression. Compressing the file too much will affect the quality of the file.

Lossy compression also comes in handy when the image you want to print is portrait size and not something the size of a banner.

Lossless Compression

If you want to use a compression method that doesn't remove any data, then Lossless Compression is what you're looking for. What Lossless Compression does is that it removes any unnecessary data, so it can reduce the file size.

For example, let's say you have two red cars, two blue cars, and three black cars: seven vehicles in total. Seven cars can take up a lot of space, so what Lossless Compression does is that it labels one red car with the number two, one black car with the number three, and the blue car with the number two.

File

Best Way To Compress Files

The following provides detailed information on folder mapping.

Xml Format

Description
File paths that match 'folderA' will be switched to 'folderB'.

  • The hierarchy of subfolders under each must exactly match.

  • Folder wildcards are not supported.

  • No file names may be specified.

    Examples

File To file mapping

The following provides detailed information on file-to-file mapping.

Xml Format

Description
Any file matching the map parameter will be read from the name and path specified in the to parameter.

For the map parameter:

  • A file name must be specified. The path is optional. If no path is specified, files from any folder may be matched.

  • File name wildcards are not supported.

  • The folder wildcard is supported.

    For the to parameter:

  • A file name and path must be specified.

  • The file name may differ from the name in the map parameter.

  • File name wildcards are not supported.

  • The folder wildcard is supported.

    Examples

File to path mapping

The following provides detailed information on file-to-path mapping.

Xml Format

Description
Any file matching the map parameter is read from the path specified in the to parameter.

For the map parameter:

  • A file name must be specified. The path is optional. If no path is specified, files from any folder may be matched.

  • File name wildcards are supported.

  • The folder wildcard is supported.

    For the to parameter:

  • A path must be specified.

  • The folder wildcard is supported.

  • A file name must not be specified.

    Examples

Example mapping

The following XML code sample shows a complete mapping file that enables the SolutionPackager tool to read any web resource and the two default generated assemblies from a Developer Toolkit project named CRMDevTookitSample.

Managed and unmanaged solutions

A Dynamics 365 Customer Engagement (on-premises) compressed solution (.zip) file can be exported in one of two types as shown here.

Managed solution
A completed solution ready to be imported into an organization. Once imported, components can't be added or removed, although they can optionally allow further customization. This is recommended when development of the solution is complete.

Unmanaged solution
An open solution with no restrictions on what can be added, removed, or modified. This is recommended during development of a solution.

The format of a compressed solution file will be different based on its type, either managed or unmanaged. The SolutionPackager can process compressed solution files of either type. However, the tool can't convert one type to another. The only way to convert solution files to a different type, for example from unmanaged to managed, is by importing the unmanaged solution .zip file into a Dynamics 365 Server and then exporting the solution as a managed solution.

The SolutionPackager can process unmanaged and managed solution .zip files as a combined set via the /PackageType:Both parameter. To perform this operation, it is necessary to export your solution twice as each type, naming the .zip files as follows.

Unmanaged .zip file: AnyName.zipManaged .zip file: AnyName_managed.zip

The tool will assume the presence of the managed zip file in the same folder as the unmanaged file and extract both files into a single folder preserving the differences where managed and unmanaged components exist.

After a solution has been extracted as both unmanaged and managed, it is possible from that single folder to pack both, or each type individually, using the /PackageType parameter to specify which type to create. When specifying both, two .zip files will be produced using the naming convention as above. If the /PackageType parameter is missing when packing from a dual managed and unmanaged folder, the default is to produce a single unmanaged .zip file.

Troubleshooting

If you use Visual Studio 2012 to edit resource files created by the solution packager, you may receive a message when you repack similar to this: 'Failed to determine version id of the resource file .resx the resource file must be exported from the solutionpackager.exe tool in order to be used as part of the pack process.' This happens because Visual Studio replaces the resource file's metadata tags with data tags.

Workaround

  1. Open the resource file in your favorite text editor and locate and update the following tags:

  2. Change the node name from to . Gimp paint studio.

    For example, this string:

    Changes to:

    This allows the solution packager to read and import the resource file. This problem has only been observed when using the Visual Studio Resource editor.

See also

Solution Tools for Team Development
Use Source Control with Solution Files
Solution Component File Reference
Introduction to Solutions

Note

Can you tell us about your documentation language preferences? Take a short survey.

The survey will take about seven minutes. No personal data is collected (privacy statement).

When you need to send a file, but it's too big, the first thing that crosses your mind is to compress it. That's usually the fix that most users go for, but you might not be so keen to compressing a file, fearing that essential data could be lost.

Once you know what happens when you compress a file, you might not even think twice about compressing. You know that compressing a file makes it smaller and more comfortable to send, but is that all there is to it?

What Is File Compression?

File compression reduces the size of the file as much as 90%, without losing any of the primary data. Compressing a file is also known as zipping.

What Does Compressed Files Mean

Therefore, file compression helps the user save a considerable amount of disk space. File compression will create a version of one or more files with the same data that's a lot smaller than the uncompressed file.

There are different types of file compression options such as 7z, Zip, StuffIt, RAR, CZIP, and more. Every option uses a distinct compression method.

The person receiving the compressed file will need a program that'll decompress the file back to its normal state. If the receiver doesn't have a program that will open the compressed file, they won't be able to open it.

With File Compression, similar patterns and data are found and are substituted with a different identifier. For example, the word keyboard can be replaced with the number 7 that takes up a lot less space than the word keyboard.

What Changes When You Compress a File – Lossy Compression

There are two main types of file compression: Lossy and Lossless file compression. Lossy compression will take out useless data to help reduce the media file size. For example, in an audio file, there are going to be sounds that humans just can't hear.

Taking out these sounds isn't going to cause any drawbacks that will make the audio file useless. If quality is crucial to you, then you might want to avoid heavily compressing the file or using this type of compression. Compressing the file too much will affect the quality of the file.

Lossy compression also comes in handy when the image you want to print is portrait size and not something the size of a banner.

Lossless Compression

If you want to use a compression method that doesn't remove any data, then Lossless Compression is what you're looking for. What Lossless Compression does is that it removes any unnecessary data, so it can reduce the file size.

For example, let's say you have two red cars, two blue cars, and three black cars: seven vehicles in total. Seven cars can take up a lot of space, so what Lossless Compression does is that it labels one red car with the number two, one black car with the number three, and the blue car with the number two.

So, in the end, you only have three cars with their respective labels. By doing this, you give the exact same information on the numbers of vehicles in those colors but with fewer cars.

With this type of compression, the quality of the file is not compromised, and you still save space in the process.

What to Never Do

If you have a file that you compressed using the Lossy compression method, don't convert it to Lossless. Also, be careful with turning a lossy format to another.

You're only wasting your time if you try to convert the Lossy file to Lossless. Why? Because when you compress using the Lossy option, certain data is taken out. So when you try to convert that file to Lossless, none of that removed data will be redeemed.

As I mentioned earlier, void compressing a file in Lossy. The more you compress a file this way, the more the quality of the file is degraded.

How To Compress A File To Email

Conclusion

As you can see, compressing a file can make sending a file a lot easier. But, there are things to keep in mind when it comes to choosing the way the file is compressed. How often do you compress files? Let me know in the comments below.





broken image