| OLD | NEW |
| 1 #MIME type package | 1 #MIME type package |
| 2 | 2 |
| 3 Package for working with MIME type definitions and for processing | 3 Package for working with MIME type definitions and for processing |
| 4 streams of MIME multipart media types. | 4 streams of MIME multipart media types. |
| 5 | 5 |
| 6 ##Determining the MIME type for a file | 6 ##Determining the MIME type for a file |
| 7 | 7 |
| 8 The `MimeTypeResolver` class can be used to determine the MIME type of | 8 The `MimeTypeResolver` class can be used to determine the MIME type of |
| 9 a file. It supports both using the extension of the file name and | 9 a file. It supports both using the extension of the file name and |
| 10 looking at magic bytes from the begining of the file. | 10 looking at magic bytes from the begining of the file. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // HTTP request with content type multipart/form-data. | 35 // HTTP request with content type multipart/form-data. |
| 36 HttpRequest request = ...; | 36 HttpRequest request = ...; |
| 37 // Determine the boundary form the content type header | 37 // Determine the boundary form the content type header |
| 38 String boundary = request.headers.contentType.parameters['boundary']; | 38 String boundary = request.headers.contentType.parameters['boundary']; |
| 39 | 39 |
| 40 // Process the body just calculating the length of each part. | 40 // Process the body just calculating the length of each part. |
| 41 request.transform(new MimeMultipartTransformer(boundary)) | 41 request.transform(new MimeMultipartTransformer(boundary)) |
| 42 .map((part) => part.fold(0, (p, d) => p + d)) | 42 .map((part) => part.fold(0, (p, d) => p + d)) |
| 43 .listen((length) => print('Part with length $length')); | 43 .listen((length) => print('Part with length $length')); |
| 44 | 44 |
| 45 Take a look at the `HttpBodyHandler` in the [http_server][1] package for | 45 Take a look at the `HttpBodyHandler` in the [http_server][http_server] |
| 46 handling different content types in a HTTP request. | 46 package for handling different content types in a HTTP request. |
| 47 | 47 |
| 48 [1]: https://pub.dartlang.org/packages/http_server | 48 ## Features and bugs |
| 49 |
| 50 Please file feature requests and bugs at the [issue tracker][tracker]. |
| 51 |
| 52 [tracker]: https://github.com/dart-lang/sample/issues |
| 53 [http_server]: https://pub.dartlang.org/packages/http_server |
| OLD | NEW |